LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/filter - sgvmain.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 169 483 35.0 %
Date: 2012-12-27 Functions: 17 36 47.2 %
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             : 
      21             : #include <rtl/math.hxx>
      22             : #include <osl/endian.h>
      23             : #include <vcl/graph.hxx>
      24             : #include <tools/poly.hxx>
      25             : #include <svtools/filter.hxx>
      26             : #include "sgffilt.hxx"
      27             : #include "sgfbram.hxx"
      28             : #include "sgvmain.hxx"
      29             : #include "sgvspln.hxx"
      30             : #include <unotools/ucbstreamhelper.hxx>
      31             : 
      32             : #define SWAPPOINT(p) {  \
      33             :     p.x=OSL_SWAPWORD(p.x); \
      34             :     p.y=OSL_SWAPWORD(p.y); }
      35             : 
      36             : #define SWAPPAGE(p) {                         \
      37             :     p.Next   =OSL_SWAPDWORD (p.Next   );           \
      38             :     p.nList  =OSL_SWAPDWORD (p.nList  );           \
      39             :     p.ListEnd=OSL_SWAPDWORD (p.ListEnd);           \
      40             :     p.Paper.Size.x=OSL_SWAPWORD(p.Paper.Size.x); \
      41             :     p.Paper.Size.y=OSL_SWAPWORD(p.Paper.Size.y); \
      42             :     p.Paper.RandL =OSL_SWAPWORD(p.Paper.RandL ); \
      43             :     p.Paper.RandR =OSL_SWAPWORD(p.Paper.RandR ); \
      44             :     p.Paper.RandO =OSL_SWAPWORD(p.Paper.RandO ); \
      45             :     p.Paper.RandU =OSL_SWAPWORD(p.Paper.RandU ); \
      46             :     SWAPPOINT(p.U);                           \
      47             :     sal_uInt16 iTemp;                             \
      48             :     for (iTemp=0;iTemp<20;iTemp++) {          \
      49             :         rPage.HlpLnH[iTemp]=OSL_SWAPWORD(rPage.HlpLnH[iTemp]);       \
      50             :         rPage.HlpLnV[iTemp]=OSL_SWAPWORD(rPage.HlpLnV[iTemp]);      }}
      51             : 
      52             : #define SWAPOBJK(o) {                 \
      53             :     o.Last    =OSL_SWAPDWORD (o.Last    ); \
      54             :     o.Next    =OSL_SWAPDWORD (o.Next    ); \
      55             :     o.MemSize =OSL_SWAPWORD(o.MemSize ); \
      56             :     SWAPPOINT(o.ObjMin);              \
      57             :     SWAPPOINT(o.ObjMax);              }
      58             : 
      59             : #define SWAPLINE(l) {             \
      60             :     l.LMSize=OSL_SWAPWORD(l.LMSize); \
      61             :     l.LDicke=OSL_SWAPWORD(l.LDicke); }
      62             : 
      63             : #define SWAPAREA(a) {               \
      64             :     a.FDummy2=OSL_SWAPWORD(a.FDummy2); \
      65             :     a.FMuster=OSL_SWAPWORD(a.FMuster); }
      66             : 
      67             : #define SWAPTEXT(t) {               \
      68             :     SWAPLINE(t.L);                  \
      69             :     SWAPAREA(t.F);                  \
      70             :     t.FontLo =OSL_SWAPWORD(t.FontLo ); \
      71             :     t.FontHi =OSL_SWAPWORD(t.FontHi ); \
      72             :     t.Grad   =OSL_SWAPWORD(t.Grad   ); \
      73             :     t.Breite =OSL_SWAPWORD(t.Breite ); \
      74             :     t.Schnitt=OSL_SWAPWORD(t.Schnitt); \
      75             :     t.LnFeed =OSL_SWAPWORD(t.LnFeed ); \
      76             :     t.Slant  =OSL_SWAPWORD(t.Slant  ); \
      77             :     SWAPLINE(t.ShdL);               \
      78             :     SWAPAREA(t.ShdF);               \
      79             :     SWAPPOINT(t.ShdVers);           \
      80             :     SWAPAREA(t.BackF);              }
      81             : 
      82             : 
      83             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      84             : //
      85             : //  Einschraenkungen:
      86             : //
      87             : //  - Flaechenmuster werden den unter StarView verfuegbaren Mustern angenaehert.
      88             : //  - Linienenden werden unter StarView immer rund dargestellt und gehen ueber
      89             : //    den Endpunkt der Linie hinaus.
      90             : //  - Linienmuster werden den unter StarView verfuegbaren Mustern angenaehert.
      91             : //    Transparent/Opak wird zur Zeit noch nicht beruecksichtigt.
      92             : //  - Keine gedrehten Ellipsen
      93             : //
      94             : //
      95             : //
      96             : //
      97             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      98             : 
      99             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     100             : // Fuer Fontuebersetzung ///////////////////////////////////////////////////////////////////////////
     101             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     102             : SgfFontLst* pSgfFonts = 0;
     103             : 
     104             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     105             : // Fuer Kreisunterarten, Text und gedrehte Rechtecke ///////////////////////////////////////////////
     106             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     107           0 : void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs)
     108             : {
     109             :     sal_Int16  dx,dy;
     110             :     double x1,y1;
     111           0 :     dx=P.x-cx;
     112           0 :     dy=P.y-cy;
     113           0 :     x1=dx*cs-dy*sn;
     114           0 :     y1=dy*cs+dx*sn;
     115           0 :     P.x=cx+sal_Int16(x1);
     116           0 :     P.y=cy+sal_Int16(y1);
     117           0 : }
     118             : 
     119           0 : void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs)
     120             : {
     121             :     sal_Int16  dx,dy;
     122             :     double x1,y1;
     123           0 :     dx=(sal_Int16)(P.X()-cx);
     124           0 :     dy=(sal_Int16)(P.Y()-cy);
     125           0 :     x1=dx*cs-dy*sn;
     126           0 :     y1=dy*cs+dx*sn;
     127           0 :     P=Point(cx+sal_Int16(x1),cy+sal_Int16(y1));
     128           0 : }
     129             : 
     130           0 : sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div)
     131             : {
     132             :     sal_Int32 Temp;
     133           0 :     Temp=sal_Int32(a)*sal_Int32(Mul)/sal_Int32(Div);
     134           0 :     return sal_Int16(Temp);
     135             : }
     136             : 
     137           0 : sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div)
     138             : {
     139             :     sal_uInt32 Temp;
     140           0 :     Temp=sal_uInt32(a)*sal_uInt32(Mul)/sal_uInt32(Div);
     141           0 :     return sal_uInt16(Temp);
     142             : }
     143             : 
     144             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     145             : // SgfFilterSDrw ///////////////////////////////////////////////////////////////////////////////////
     146             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     147             : 
     148           0 : SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd)
     149             : {
     150           0 :     rIStream.Read((char*)&rDtHd.Reserved[0],DtHdSize);
     151           0 :     return rIStream;
     152             : }
     153             : 
     154           2 : void DtHdOverSeek(SvStream& rInp)
     155             : {
     156           2 :     sal_uLong FPos=rInp.Tell();
     157           2 :     FPos+=(sal_uLong)DtHdSize;
     158           2 :     rInp.Seek(FPos);
     159           2 : }
     160             : 
     161             : 
     162           8 : SvStream& operator>>(SvStream& rIStream, PageType& rPage)
     163             : {
     164           8 :     rIStream.Read((char*)&rPage.Next,PageSize);
     165             : #if defined OSL_BIGENDIAN
     166             :     SWAPPAGE(rPage);
     167             : #endif
     168           8 :     return rIStream;
     169             : }
     170             : 
     171           0 : void ObjkOverSeek(SvStream& rInp, ObjkType& rObjk)
     172             : {
     173             :     sal_uLong Siz;
     174           0 :     Siz=(sal_uLong)rObjk.MemSize+rObjk.Last;  // ObjSize+ObjAnhSize
     175           0 :     rInp.Seek(rInp.Tell()+Siz);
     176           0 : }
     177             : 
     178           8 : SvStream& operator>>(SvStream& rInp, ObjkType& rObjk)
     179             : {   // Die Fileposition im Stream bleibt unveraendert!
     180             :     sal_uLong nPos;
     181           8 :     nPos=rInp.Tell();
     182           8 :     rInp.Read((char*)&rObjk.Last,ObjkSize);
     183             : #if defined OSL_BIGENDIAN
     184             :     SWAPOBJK(rObjk);
     185             : #endif
     186             : #ifdef InArbeit
     187             :     sal_uLong nPos1=rInp.Tell();
     188             :     if(nPos == nPos1) InfoBox( NULL, "tellg funkt nich" ).Execute();
     189             : #endif
     190           8 :     rInp.Seek(nPos);
     191             : #ifdef InArbeit
     192             :     if (rInp.Tell() != nPos) InfoBox( NULL, "seekg funkt nich" ).Execute();
     193             : #endif
     194           8 :     return rInp;
     195             : }
     196           0 : SvStream& operator>>(SvStream& rInp, StrkType& rStrk)
     197             : {
     198           0 :     rInp.Read((char*)&rStrk.Last,StrkSize);
     199             : #if defined OSL_BIGENDIAN
     200             :     SWAPOBJK (rStrk);
     201             :     SWAPLINE (rStrk.L);
     202             :     SWAPPOINT(rStrk.Pos1);
     203             :     SWAPPOINT(rStrk.Pos2);
     204             : #endif
     205           0 :     return rInp;
     206             : }
     207           0 : SvStream& operator>>(SvStream& rInp, RectType& rRect)
     208             : {
     209           0 :     rInp.Read((char*)&rRect.Last,RectSize);
     210             : #if defined OSL_BIGENDIAN
     211             :     SWAPOBJK (rRect);
     212             :     SWAPLINE (rRect.L);
     213             :     SWAPAREA (rRect.F);
     214             :     SWAPPOINT(rRect.Pos1);
     215             :     SWAPPOINT(rRect.Pos2);
     216             :     rRect.Radius  =OSL_SWAPWORD(rRect.Radius  );
     217             :     rRect.DrehWink=OSL_SWAPWORD(rRect.DrehWink);
     218             :     rRect.Slant   =OSL_SWAPWORD(rRect.Slant   );
     219             : #endif
     220           0 :     return rInp;
     221             : }
     222           3 : SvStream& operator>>(SvStream& rInp, PolyType& rPoly)
     223             : {
     224           3 :     rInp.Read((char*)&rPoly.Last,PolySize);
     225             : #if defined OSL_BIGENDIAN
     226             :     SWAPOBJK (rPoly);
     227             :     SWAPLINE (rPoly.L);
     228             :     SWAPAREA (rPoly.F);
     229             : #endif
     230           3 :     return rInp;
     231             : }
     232           3 : SvStream& operator>>(SvStream& rInp, SplnType& rSpln)
     233             : {
     234           3 :     rInp.Read((char*)&rSpln.Last,SplnSize);
     235             : #if defined OSL_BIGENDIAN
     236             :     SWAPOBJK (rSpln);
     237             :     SWAPLINE (rSpln.L);
     238             :     SWAPAREA (rSpln.F);
     239             : #endif
     240           3 :     return rInp;
     241             : }
     242           1 : SvStream& operator>>(SvStream& rInp, CircType& rCirc)
     243             : {
     244           1 :     rInp.Read((char*)&rCirc.Last,CircSize);
     245             : #if defined OSL_BIGENDIAN
     246             :     SWAPOBJK (rCirc);
     247             :     SWAPLINE (rCirc.L);
     248             :     SWAPAREA (rCirc.F);
     249             :     SWAPPOINT(rCirc.Radius);
     250             :     SWAPPOINT(rCirc.Center);
     251             :     rCirc.DrehWink =OSL_SWAPWORD(rCirc.DrehWink );
     252             :     rCirc.StartWink=OSL_SWAPWORD(rCirc.StartWink);
     253             :     rCirc.RelWink  =OSL_SWAPWORD(rCirc.RelWink  );
     254             : #endif
     255           1 :     return rInp;
     256             : }
     257           0 : SvStream& operator>>(SvStream& rInp, TextType& rText)
     258             : {
     259           0 :     rInp.Read((char*)&rText.Last,TextSize);
     260             : #if defined OSL_BIGENDIAN
     261             :     SWAPOBJK (rText);
     262             :     SWAPTEXT (rText.T);
     263             :     SWAPPOINT(rText.Pos1);
     264             :     SWAPPOINT(rText.Pos2);
     265             :     rText.TopOfs  =OSL_SWAPWORD(rText.TopOfs  );
     266             :     rText.DrehWink=OSL_SWAPWORD(rText.DrehWink);
     267             :     rText.BoxSlant=OSL_SWAPWORD(rText.BoxSlant);
     268             :     rText.BufSize =OSL_SWAPWORD(rText.BufSize );
     269             :     SWAPPOINT(rText.FitSize);
     270             :     rText.FitBreit=OSL_SWAPWORD(rText.FitBreit);
     271             : #endif
     272           0 :     rText.Buffer=NULL;
     273           0 :     return rInp;
     274             : }
     275           0 : SvStream& operator>>(SvStream& rInp, BmapType& rBmap)
     276             : {
     277           0 :     rInp.Read((char*)&rBmap.Last,BmapSize);
     278             : #if defined OSL_BIGENDIAN
     279             :     SWAPOBJK (rBmap);
     280             :     SWAPAREA (rBmap.F);
     281             :     SWAPPOINT(rBmap.Pos1);
     282             :     SWAPPOINT(rBmap.Pos2);
     283             :     rBmap.DrehWink=OSL_SWAPWORD(rBmap.DrehWink);
     284             :     rBmap.Slant   =OSL_SWAPWORD(rBmap.Slant   );
     285             :     SWAPPOINT(rBmap.PixSize);
     286             : #endif
     287           0 :     return rInp;
     288             : }
     289           1 : SvStream& operator>>(SvStream& rInp, GrupType& rGrup)
     290             : {
     291           1 :     rInp.Read((char*)&rGrup.Last,GrupSize);
     292             : #if defined OSL_BIGENDIAN
     293             :     SWAPOBJK (rGrup);
     294             :     rGrup.SbLo     =OSL_SWAPWORD(rGrup.SbLo     );
     295             :     rGrup.SbHi     =OSL_SWAPWORD(rGrup.SbHi     );
     296             :     rGrup.UpLo     =OSL_SWAPWORD(rGrup.UpLo     );
     297             :     rGrup.UpHi     =OSL_SWAPWORD(rGrup.UpHi     );
     298             :     rGrup.ChartSize=OSL_SWAPWORD(rGrup.ChartSize);
     299             :     rGrup.ChartPtr =OSL_SWAPDWORD (rGrup.ChartPtr );
     300             : #endif
     301           1 :     return rInp;
     302             : }
     303             : 
     304             : 
     305             : 
     306             : /*************************************************************************
     307             : |*
     308             : |*    Sgv2SvFarbe()
     309             : |*
     310             : *************************************************************************/
     311          12 : Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts)
     312             : {
     313          12 :     sal_uInt16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0;
     314          12 :     sal_uInt8   nInt2=100-nInts;
     315          12 :     switch(nFrb1 & 0x07) {
     316           1 :         case 0:  r1=0xFF; g1=0xFF; b1=0xFF; break;
     317           0 :         case 1:  r1=0xFF; g1=0xFF;            break;
     318           0 :         case 2:           g1=0xFF; b1=0xFF; break;
     319           1 :         case 3:           g1=0xFF;            break;
     320           1 :         case 4:  r1=0xFF;          b1=0xFF; break;
     321           0 :         case 5:  r1=0xFF;                       break;
     322           1 :         case 6:                    b1=0xFF; break;
     323           8 :         case 7:                                   break;
     324             :     }
     325          12 :     switch(nFrb2 & 0x07) {
     326          12 :         case 0:  r2=0xFF; g2=0xFF; b2=0xFF; break;
     327           0 :         case 1:  r2=0xFF; g2=0xFF;            break;
     328           0 :         case 2:           g2=0xFF; b2=0xFF; break;
     329           0 :         case 3:           g2=0xFF;            break;
     330           0 :         case 4:  r2=0xFF;          b2=0xFF; break;
     331           0 :         case 5:  r2=0xFF;                       break;
     332           0 :         case 6:                    b2=0xFF; break;
     333           0 :         case 7:                                   break;
     334             :     }
     335          12 :     r1=(sal_uInt16)((sal_uInt32)r1*nInts/100+(sal_uInt32)r2*nInt2/100);
     336          12 :     g1=(sal_uInt16)((sal_uInt32)g1*nInts/100+(sal_uInt32)g2*nInt2/100);
     337          12 :     b1=(sal_uInt16)((sal_uInt32)b1*nInts/100+(sal_uInt32)b2*nInt2/100);
     338          12 :     Color aColor( (sal_uInt8)r1, (sal_uInt8)g1, (sal_uInt8)b1 );
     339          12 :     return aColor;
     340             : }
     341             : 
     342           7 : void SetLine(ObjLineType& rLine, OutputDevice& rOut)
     343             : {
     344           7 :     if( 0 == ( rLine.LMuster & 0x07 ) )
     345           0 :         rOut.SetLineColor();
     346             :     else
     347           7 :         rOut.SetLineColor( Sgv2SvFarbe(rLine.LFarbe,rLine.LBFarbe,rLine.LIntens) );
     348           7 : }
     349             : 
     350           7 : void SetArea(ObjAreaType& rArea, OutputDevice& rOut)
     351             : {
     352           7 :     if( 0 == ( rArea.FMuster & 0x00FF ) )
     353           2 :         rOut.SetFillColor();
     354             :     else
     355           5 :         rOut.SetFillColor( Sgv2SvFarbe( rArea.FFarbe,rArea.FBFarbe,rArea.FIntens ) );
     356           7 : }
     357             : 
     358             : /*************************************************************************
     359             : |*
     360             : |*    ObjkType::DrawObjekt()
     361             : |*
     362             : *************************************************************************/
     363           0 : void ObjkType::Draw(OutputDevice&)
     364             : {
     365           0 : }
     366             : 
     367           0 : void Obj0Type::Draw(OutputDevice&) {}
     368             : 
     369             : /*************************************************************************
     370             : |*
     371             : |*    StrkType::DrawObjekt()
     372             : |*
     373             : *************************************************************************/
     374           0 : void StrkType::Draw(OutputDevice& rOut)
     375             : {
     376           0 :     SetLine(L,rOut);
     377           0 :     rOut.DrawLine(Point(Pos1.x,Pos1.y),Point(Pos2.x,Pos2.y)); // !!!
     378           0 : }
     379             : 
     380             : /*************************************************************************
     381             : |*
     382             : |*    RectType::DrawObjekt()
     383             : |*
     384             : *************************************************************************/
     385           0 : void SgfAreaColorIntens(sal_uInt16 Muster, sal_uInt8 Col1, sal_uInt8 Col2, sal_uInt8 Int, OutputDevice& rOut)
     386             : {
     387             :     ObjAreaType F;
     388           0 :     F.FMuster=Muster;
     389           0 :     F.FFarbe=Col2;
     390           0 :     F.FBFarbe=Col1;
     391           0 :     F.FIntens=Int;
     392           0 :     SetArea(F,rOut);
     393           0 : }
     394             : 
     395           0 : void DrawSlideRect(sal_Int16 x1, sal_Int16 y1, sal_Int16 x2, sal_Int16 y2, ObjAreaType& F, OutputDevice& rOut)
     396             : {
     397             :     sal_Int16 i,i0,b,b0;
     398             :     sal_Int16 Int1,Int2;
     399             :     sal_Int16 Col1,Col2;
     400             :     //     ClipMerk: HgdClipRec;
     401             :     sal_Int16 cx,cy;
     402             :     sal_Int16 MaxR;
     403             :     sal_Int32 dx,dy;
     404             : 
     405           0 :     rOut.SetLineColor();
     406           0 :     if (x1>x2) { i=x1; x1=x2; x2=i; }
     407           0 :     if (y1>y2) { i=y1; y1=y2; y2=i; }
     408           0 :     Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87;
     409           0 :     Int1=100-F.FIntens; Int2=F.FIntens;
     410           0 :     if (Int1==Int2) {
     411           0 :         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     412           0 :         rOut.DrawRect(Rectangle(x1,y1,x2,y2));
     413             :     } else {
     414           0 :         b0=Int1;
     415           0 :         switch (F.FBFarbe & 0x38) {
     416             :             case 0x08: { // vertikal
     417           0 :                 i0=y1;
     418           0 :                 i=y1;
     419           0 :                 while (i<=y2) {
     420           0 :                     b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1));
     421           0 :                     if (b!=b0) {
     422           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     423           0 :                         rOut.DrawRect(Rectangle(x1,i0,x2,i-1));
     424           0 :                         i0=i; b0=b;
     425             :                     }
     426           0 :                     i++;
     427             :                 }
     428           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     429           0 :                 rOut.DrawRect(Rectangle(x1,i0,x2,y2));
     430           0 :             } break;
     431             :             case 0x28: { // horizontal
     432           0 :                 i0=x1;
     433           0 :                 i=x1;
     434           0 :                 while (i<=x2) {
     435           0 :                     b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1));
     436           0 :                     if (b!=b0) {
     437           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     438           0 :                         rOut.DrawRect(Rectangle(i0,y1,i-1,y2));
     439           0 :                         i0=i; b0=b;
     440             :                     }
     441           0 :                     i++;
     442             :                 }
     443           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     444           0 :                 rOut.DrawRect(Rectangle(i0,y1,x2,y2));
     445           0 :             } break;
     446             : 
     447             :             case 0x18: case 0x38: { // Kreis
     448           0 :                 Region ClipMerk=rOut.GetClipRegion();
     449             :                 double a;
     450             : 
     451           0 :                 rOut.SetClipRegion(Region(Rectangle(x1,y1,x2,y2)));
     452           0 :                 cx=(x1+x2) /2;
     453           0 :                 cy=(y1+y2) /2;
     454           0 :                 dx=x2-x1+1;
     455           0 :                 dy=y2-y1+1;
     456           0 :                 a=sqrt((double)(dx*dx+dy*dy));
     457           0 :                 MaxR=sal_Int16(a) /2 +1;
     458           0 :                 b0=Int2;
     459           0 :                 i0=MaxR; if (MaxR<1) MaxR=1;
     460           0 :                 i=MaxR;
     461           0 :                 while (i>=0) {
     462           0 :                     b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR));
     463           0 :                     if (b!=b0) {
     464           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     465           0 :                         rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
     466           0 :                         i0=i; b0=b;
     467             :                     }
     468           0 :                     i--;
     469             :                 }
     470           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut);
     471           0 :                 rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
     472           0 :                 rOut.SetClipRegion(ClipMerk);
     473           0 :             } break; // Kreis
     474             :         }
     475             :     }
     476           0 : }
     477             : 
     478             : 
     479           0 : void RectType::Draw(OutputDevice& rOut)
     480             : {
     481           0 :     if (L.LMuster!=0) L.LMuster=1; // keine Linienmuster hier, nur an oder aus
     482           0 :     SetArea(F,rOut);
     483           0 :     if (DrehWink==0) {
     484           0 :     if ((F.FBFarbe & 0x38)==0 || Radius!=0) {
     485           0 :             SetLine(L,rOut);
     486           0 :             rOut.DrawRect(Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y),Radius,Radius);
     487             :         } else {
     488           0 :             DrawSlideRect(Pos1.x,Pos1.y,Pos2.x,Pos2.y,F,rOut);
     489           0 :             if (L.LMuster!=0) {
     490           0 :                 SetLine(L,rOut);
     491           0 :                 rOut.SetFillColor();
     492           0 :                 rOut.DrawRect(Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y));
     493             :             }
     494             :         }
     495             :     } else {
     496           0 :         Point  aPts[4];
     497             :         sal_uInt16 i;
     498             :         double sn,cs;
     499           0 :         sn=sin(double(DrehWink)*3.14159265359/18000);
     500           0 :         cs=cos(double(DrehWink)*3.14159265359/18000);
     501           0 :         aPts[0]=Point(Pos1.x,Pos1.y);
     502           0 :         aPts[1]=Point(Pos2.x,Pos1.y);
     503           0 :         aPts[2]=Point(Pos2.x,Pos2.y);
     504           0 :         aPts[3]=Point(Pos1.x,Pos2.y);
     505           0 :         for (i=0;i<4;i++) {
     506           0 :             RotatePoint(aPts[i],Pos1.x,Pos1.y,sn,cs);
     507             :         }
     508           0 :         SetLine(L,rOut);
     509           0 :         Polygon aPoly(4,aPts);
     510           0 :         rOut.DrawPolygon(aPoly);
     511             :     }
     512           0 : }
     513             : 
     514             : /*************************************************************************
     515             : |*
     516             : |*    PolyType::Draw()
     517             : |*
     518             : *************************************************************************/
     519           3 : void PolyType::Draw(OutputDevice& rOut)
     520             : {
     521           3 :     if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
     522           3 :     SetLine(L,rOut);
     523           3 :     Polygon aPoly(nPoints);
     524             :     sal_uInt16 i;
     525           3 :     for(i=0;i<nPoints;i++) aPoly.SetPoint(Point(EckP[i].x,EckP[i].y),i);
     526           3 :     if ((Flags & PolyClosBit) !=0) {
     527           3 :         rOut.DrawPolygon(aPoly);
     528             :     } else {
     529           0 :         rOut.DrawPolyLine(aPoly);
     530           3 :     }
     531           3 : }
     532             : 
     533             : /*************************************************************************
     534             : |*
     535             : |*    SplnType::Draw()
     536             : |*
     537             : *************************************************************************/
     538           3 : void SplnType::Draw(OutputDevice& rOut)
     539             : {
     540           3 :     if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
     541           3 :     SetLine(L,rOut);
     542           3 :     Polygon aPoly(0);
     543           3 :     Polygon aSpln(nPoints);
     544             :     sal_uInt16 i;
     545           3 :     for(i=0;i<nPoints;i++) aSpln.SetPoint(Point(EckP[i].x,EckP[i].y),i);
     546           3 :     if ((Flags & PolyClosBit) !=0) {
     547           3 :         Spline2Poly(aSpln,sal_True,aPoly);
     548           3 :         if (aPoly.GetSize()>0) rOut.DrawPolygon(aPoly);
     549             :     } else {
     550           0 :         Spline2Poly(aSpln,sal_False,aPoly);
     551           0 :         if (aPoly.GetSize()>0) rOut.DrawPolyLine(aPoly);
     552           3 :     }
     553           3 : }
     554             : 
     555             : /*************************************************************************
     556             : |*
     557             : |*    CircType::Draw()
     558             : |*
     559             : *************************************************************************/
     560           0 : void DrawSlideCirc(sal_Int16 cx, sal_Int16 cy, sal_Int16 rx, sal_Int16 ry, ObjAreaType& F, OutputDevice& rOut)
     561             : {
     562           0 :     sal_Int16 x1=cx-rx;
     563           0 :     sal_Int16 y1=cy-ry;
     564           0 :     sal_Int16 x2=cx+rx;
     565           0 :     sal_Int16 y2=cy+ry;
     566             : 
     567             :     sal_Int16 i,i0,b,b0;
     568             :     sal_Int16 Int1,Int2;
     569             :     sal_Int16 Col1,Col2;
     570             : 
     571           0 :     rOut.SetLineColor();
     572           0 :     Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87;
     573           0 :     Int1=100-F.FIntens; Int2=F.FIntens;
     574           0 :     if (Int1==Int2) {
     575           0 :         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     576           0 :         rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
     577             :     } else {
     578           0 :         b0=Int1;
     579           0 :         switch (F.FBFarbe & 0x38) {
     580             :             case 0x08: { // vertikal
     581           0 :                 Region ClipMerk=rOut.GetClipRegion();
     582           0 :                 i0=y1;
     583           0 :                 i=y1;
     584           0 :                 while (i<=y2) {
     585           0 :                     b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1));
     586           0 :                     if (b!=b0) {
     587           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     588           0 :                         rOut.SetClipRegion(Rectangle(x1,i0,x2,i-1));
     589           0 :                         rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
     590           0 :                         i0=i; b0=b;
     591             :                     }
     592           0 :                     i++;
     593             :                 }
     594           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     595           0 :                 rOut.SetClipRegion(Rectangle(x1,i0,x2,y2));
     596           0 :                 rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
     597           0 :                 rOut.SetClipRegion(ClipMerk);
     598           0 :             } break;
     599             :             case 0x28: { // horizontal
     600           0 :                 Region ClipMerk=rOut.GetClipRegion();
     601           0 :                 i0=x1;
     602           0 :                 i=x1;
     603           0 :                 while (i<=x2) {
     604           0 :                     b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1));
     605           0 :                     if (b!=b0) {
     606           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     607           0 :                         rOut.SetClipRegion(Rectangle(i0,y1,i-1,y2));
     608           0 :                         rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
     609           0 :                         i0=i; b0=b;
     610             :                     }
     611           0 :                     i++;
     612             :                 }
     613           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut);
     614           0 :                 rOut.SetClipRegion(Rectangle(i0,y1,x2,y2));
     615           0 :                 rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
     616           0 :                 rOut.SetClipRegion(ClipMerk);
     617           0 :             } break;
     618             : 
     619             :             case 0x18: case 0x38: { // Kreis
     620             :                 sal_Int16 MaxR;
     621             : 
     622           0 :                 if (rx<1) rx=1;
     623           0 :                 if (ry<1) ry=1;
     624           0 :                 MaxR=rx;
     625           0 :                 b0=Int2;
     626           0 :                 i0=MaxR; if (MaxR<1) MaxR=1;
     627           0 :                 i=MaxR;
     628           0 :                 while (i>=0) {
     629           0 :                     b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR));
     630           0 :                     if (b!=b0) {
     631           0 :                         sal_Int32 temp=sal_Int32(i0)*sal_Int32(ry)/sal_Int32(rx);
     632           0 :                         sal_Int16 j0=sal_Int16(temp);
     633           0 :                         SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut);
     634           0 :                         rOut.DrawEllipse(Rectangle(cx-i0,cy-j0,cx+i0,cy+j0));
     635           0 :                         i0=i; b0=b;
     636             :                     }
     637           0 :                     i--;
     638             :                 }
     639           0 :                 SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut);
     640           0 :                 rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
     641           0 :             } break; // Kreis
     642             :         }
     643             :     }
     644           0 : }
     645             : 
     646             : 
     647           1 : void CircType::Draw(OutputDevice& rOut)
     648             : {
     649           1 :     Rectangle aRect(Center.x-Radius.x,Center.y-Radius.y,Center.x+Radius.x,Center.y+Radius.y);
     650             : 
     651           1 :     if (L.LMuster!=0) L.LMuster=1; // keine Linienmuster hier, nur an oder aus
     652           1 :     SetArea(F,rOut);
     653           1 :     if ((Flags & 0x03)==CircFull) {
     654           1 :         if ((F.FBFarbe & 0x38)==0) {
     655           1 :             SetLine(L,rOut);
     656           1 :             rOut.DrawEllipse(aRect);
     657             :         } else {
     658           0 :             DrawSlideCirc(Center.x,Center.y,Radius.x,Radius.y,F,rOut);
     659           0 :             if (L.LMuster!=0) {
     660           0 :                 SetLine(L,rOut);
     661           0 :                 rOut.SetFillColor();
     662           0 :                 rOut.DrawEllipse(aRect);
     663             :             }
     664             :         }
     665             :     } else {
     666             :         PointType a,b;
     667           0 :         Point  aStrt,aEnde;
     668             :         double sn,cs;
     669             : 
     670           0 :         a.x=Center.x+Radius.x; a.y=Center.y; b=a;
     671           0 :         sn=sin(double(StartWink)*3.14159265359/18000);
     672           0 :         cs=cos(double(StartWink)*3.14159265359/18000);
     673           0 :         RotatePoint(a,Center.x,Center.y,sn,cs);
     674           0 :         sn=sin(double(StartWink+RelWink)*3.14159265359/18000);
     675           0 :         cs=cos(double(StartWink+RelWink)*3.14159265359/18000);
     676           0 :         RotatePoint(b,Center.x,Center.y,sn,cs);
     677           0 :         if (Radius.x!=Radius.y) {
     678           0 :           if (Radius.x<1) Radius.x=1;
     679           0 :           if (Radius.y<1) Radius.y=1;
     680           0 :           a.y = a.y - Center.y;
     681           0 :           b.y = b.y - Center.y;
     682           0 :           a.y=iMulDiv(a.y,Radius.y,Radius.x);
     683           0 :           b.y=iMulDiv(b.y,Radius.y,Radius.x);
     684           0 :           a.y = a.y + Center.y;
     685           0 :           b.y = b.y + Center.y;
     686             :         }
     687           0 :         aStrt=Point(a.x,a.y);
     688           0 :         aEnde=Point(b.x,b.y);
     689           0 :         SetLine(L,rOut);
     690           0 :         switch (Flags & 0x03) {
     691           0 :             case CircArc : rOut.DrawArc(aRect,aEnde,aStrt); break;
     692             :             case CircSect:
     693           0 :             case CircAbsn: rOut.DrawPie(aRect,aEnde,aStrt); break;
     694             :         }
     695             :     }
     696           1 : }
     697             : 
     698             : /*************************************************************************
     699             : |*
     700             : |*    BmapType::Draw()
     701             : |*
     702             : *************************************************************************/
     703             : 
     704           0 : void BmapType::Draw(OutputDevice& rOut)
     705             : {
     706             :     //ifstream aInp;
     707             :     unsigned char   nSgfTyp;
     708             :     sal_uInt16          nVersion;
     709             :     String          aStr(
     710             :         reinterpret_cast< char const * >(&Filename[ 1 ]),
     711           0 :         (xub_StrLen)Filename[ 0 ], RTL_TEXTENCODING_UTF8 );
     712           0 :     INetURLObject   aFNam( aStr );
     713             : 
     714           0 :     SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
     715           0 :     if ( pInp )
     716             :     {
     717           0 :         nSgfTyp=CheckSgfTyp( *pInp,nVersion);
     718           0 :         switch(nSgfTyp) {
     719             :             case SGF_BITIMAGE: {
     720           0 :                 GraphicFilter aFlt;
     721           0 :                 Graphic aGrf;
     722           0 :                 aFlt.ImportGraphic(aGrf,aFNam);
     723           0 :                 aGrf.Draw(&rOut,Point(Pos1.x,Pos1.y),Size(Pos2.x-Pos1.x,Pos2.y-Pos1.y));
     724           0 :             } break;
     725             :             case SGF_SIMPVECT: {
     726           0 :                 GDIMetaFile aMtf;
     727           0 :                 SgfVectXofs=Pos1.x;
     728           0 :                 SgfVectYofs=Pos1.y;
     729           0 :                 SgfVectXmul=Pos2.x-Pos1.x;
     730           0 :                 SgfVectYmul=Pos2.y-Pos1.y;
     731           0 :                 SgfVectXdiv=0;
     732           0 :                 SgfVectYdiv=0;
     733           0 :                 SgfVectScal=sal_True;
     734           0 :                 SgfVectFilter(*pInp,aMtf);
     735           0 :                 SgfVectXofs=0;
     736           0 :                 SgfVectYofs=0;
     737           0 :                 SgfVectXmul=0;
     738           0 :                 SgfVectYmul=0;
     739           0 :                 SgfVectXdiv=0;
     740           0 :                 SgfVectYdiv=0;
     741           0 :                 SgfVectScal=sal_False;
     742           0 :                 aMtf.Play(&rOut);
     743           0 :             } break;
     744             :         }
     745           0 :         delete pInp;
     746           0 :     }
     747           0 : }
     748             : 
     749             : 
     750             : /*************************************************************************
     751             : |*
     752             : |*    GrupType::...
     753             : |*
     754             : *************************************************************************/
     755           1 : sal_uInt32 GrupType::GetSubPtr()
     756             : {
     757           1 :     return sal_uInt32(SbLo)+0x00010000*sal_uInt32(SbHi);
     758             : }
     759             : 
     760             : /*************************************************************************
     761             : |*
     762             : |*    DrawObjkList()
     763             : |*
     764             : *************************************************************************/
     765           2 : void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
     766             : {
     767           2 :     ObjkType aObjk;
     768           2 :     sal_uInt16 nGrpCnt=0;
     769           2 :     sal_Bool bEnde=sal_False;
     770           8 :     do {
     771           8 :         rInp>>aObjk;
     772           8 :         if (!rInp.GetError()) {
     773           8 :             switch(aObjk.Art) {
     774           0 :                 case ObjStrk: { StrkType aStrk; rInp>>aStrk; if (!rInp.GetError()) aStrk.Draw(rOut); } break;
     775           0 :                 case ObjRect: { RectType aRect; rInp>>aRect; if (!rInp.GetError()) aRect.Draw(rOut); } break;
     776           1 :                 case ObjCirc: { CircType aCirc; rInp>>aCirc; if (!rInp.GetError()) aCirc.Draw(rOut); } break;
     777             :                 case ObjText: {
     778           0 :                     TextType aText;
     779           0 :                     rInp>>aText;
     780           0 :                     if (!rInp.GetError()) {
     781           0 :                         aText.Buffer=new UCHAR[aText.BufSize+1]; // Ein mehr fuer LookAhead bei CK-Trennung
     782           0 :                         rInp.Read((char* )aText.Buffer,aText.BufSize);
     783           0 :                         if (!rInp.GetError()) aText.Draw(rOut);
     784           0 :                         delete[] aText.Buffer;
     785           0 :                     }
     786           0 :                 } break;
     787             :                 case ObjBmap: {
     788           0 :                     BmapType aBmap;
     789           0 :                     rInp>>aBmap;
     790           0 :                     if (!rInp.GetError()) {
     791           0 :                         aBmap.Draw(rOut);
     792           0 :                     }
     793           0 :                 } break;
     794             :                 case ObjPoly: {
     795           3 :                     PolyType aPoly;
     796           3 :                     rInp>>aPoly;
     797           3 :                     if (!rInp.GetError()) {
     798           3 :                         aPoly.EckP=new PointType[aPoly.nPoints];
     799           3 :                         rInp.Read((char*)aPoly.EckP,4*aPoly.nPoints);
     800             : #if defined OSL_BIGENDIAN
     801             :                         for(short i=0;i<aPoly.nPoints;i++) SWAPPOINT(aPoly.EckP[i]);
     802             : #endif
     803           3 :                         if (!rInp.GetError()) aPoly.Draw(rOut);
     804           3 :                         delete[] aPoly.EckP;
     805           3 :                     }
     806           3 :                 } break;
     807             :                 case ObjSpln: {
     808           3 :                     SplnType aSpln;
     809           3 :                     rInp>>aSpln;
     810           3 :                     if (!rInp.GetError()) {
     811           3 :                         aSpln.EckP=new PointType[aSpln.nPoints];
     812           3 :                         rInp.Read((char*)aSpln.EckP,4*aSpln.nPoints);
     813             : #if defined OSL_BIGENDIAN
     814             :                         for(short i=0;i<aSpln.nPoints;i++) SWAPPOINT(aSpln.EckP[i]);
     815             : #endif
     816           3 :                         if (!rInp.GetError()) aSpln.Draw(rOut);
     817           3 :                         delete[] aSpln.EckP;
     818           3 :                     }
     819           3 :                 } break;
     820             :                 case ObjGrup: {
     821           1 :                     GrupType aGrup;
     822           1 :                     rInp>>aGrup;
     823           1 :                     if (!rInp.GetError()) {
     824           1 :                         rInp.Seek(rInp.Tell()+aGrup.Last); // Obj-Anhaengsel
     825           1 :                         if(aGrup.GetSubPtr()!=0L) nGrpCnt++;// DrawObjkList(rInp,rOut );
     826           1 :                     }
     827           1 :                 } break;
     828             :                 default: {
     829           0 :                     aObjk.Draw(rOut);          // Objektbezeichnung auf 2. Screen
     830           0 :                     ObjkOverSeek(rInp,aObjk);  // zum naechsten Objekt
     831             :                 }
     832             :             }
     833             :         } // if rInp
     834           8 :         if (!rInp.GetError()) {
     835           8 :             if (aObjk.Next==0L) {
     836           3 :                 if (nGrpCnt==0) bEnde=sal_True;
     837           1 :                 else nGrpCnt--;
     838             :             }
     839             :         } else {
     840           0 :             bEnde=sal_True;  // Lesefehler
     841             :         }
     842          10 :     } while (!bEnde);
     843           2 : }
     844             : 
     845             : /*************************************************************************
     846             : |*
     847             : |*    SkipObjkList()
     848             : |*
     849             : *************************************************************************/
     850           0 : void SkipObjkList(SvStream& rInp)
     851             : {
     852           0 :     ObjkType aObjk;
     853           0 :     do
     854             :     {
     855           0 :         rInp>>aObjk;
     856           0 :         if(aObjk.Art==ObjGrup) {
     857           0 :             GrupType aGrup;
     858           0 :             rInp>>aGrup;
     859           0 :             rInp.Seek(rInp.Tell()+aGrup.Last); // Obj-Anhaengsel
     860           0 :             if(aGrup.GetSubPtr()!=0L) SkipObjkList(rInp);
     861             :         } else {
     862           0 :             ObjkOverSeek(rInp,aObjk);  // zum naechsten Objekt
     863             :         }
     864           0 :     } while (aObjk.Next!=0L && !rInp.GetError());
     865           0 : }
     866             : 
     867             : /*************************************************************************
     868             : |*
     869             : |*    SgfFilterSDrw()
     870             : |*
     871             : *************************************************************************/
     872           2 : sal_Bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf )
     873             : {
     874           2 :     sal_Bool          bRet = sal_False;
     875             :     PageType      aPage;
     876           2 :     VirtualDevice aOutDev;
     877             :     OutputDevice* pOutDev;
     878             :     sal_uLong         nStdPos;
     879             :     sal_uLong         nZchPos;
     880             :     sal_uInt16        Num;
     881             : 
     882           2 :     pOutDev=&aOutDev;
     883           2 :     DtHdOverSeek(rInp); // DataHeader weglesen
     884             : 
     885           2 :     nStdPos=rInp.Tell();
     886           2 :     do {                // Standardseiten weglesen
     887           2 :         rInp>>aPage;
     888           2 :         if (aPage.nList!=0) SkipObjkList(rInp);
     889           0 :     } while (aPage.Next!=0L && !rInp.GetError());
     890             : 
     891             : //    ShowMsg("Zeichnungseite(n)\n");
     892           2 :     nZchPos=rInp.Tell();
     893           2 :     rInp>>aPage;
     894             : 
     895           2 :     rMtf.Record(pOutDev);
     896           2 :     Num=aPage.StdPg;
     897           2 :     if (Num!=0) {
     898           2 :       rInp.Seek(nStdPos);
     899           4 :       while(Num>1 && aPage.Next!=0L && !rInp.GetError()) { // Standardseite suchen
     900           0 :         rInp>>aPage;
     901           0 :         if (aPage.nList!=0) SkipObjkList(rInp);
     902           0 :         Num--;
     903             :       }
     904           2 :       rInp>>aPage;
     905           2 :       if(Num==1 && aPage.nList!=0L) DrawObjkList( rInp,*pOutDev );
     906           2 :       rInp.Seek(nZchPos);
     907           2 :       nZchPos=rInp.Tell();
     908           2 :       rInp>>aPage;
     909             :     }
     910           2 :     if (aPage.nList!=0L) DrawObjkList(rInp,*pOutDev );
     911             : 
     912           2 :     rMtf.Stop();
     913           2 :     rMtf.WindStart();
     914           2 :     MapMode aMap(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4));
     915           2 :     rMtf.SetPrefMapMode(aMap);
     916           2 :     rMtf.SetPrefSize(Size((sal_Int16)aPage.Paper.Size.x,(sal_Int16)aPage.Paper.Size.y));
     917           2 :     bRet=sal_True;
     918           2 :     return bRet;
     919             : }
     920             : 
     921             : 
     922             : 
     923             : /*************************************************************************
     924             : |*
     925             : |*    SgfSDrwFilter()
     926             : |*
     927             : *************************************************************************/
     928           2 : sal_Bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath )
     929             : {
     930             : #if OSL_DEBUG_LEVEL > 1 // Recordgroessen checken. Neuer Compiler hat vielleichte anderes Alignment!
     931             :     if (sizeof(ObjTextType)!=ObjTextTypeSize)  return sal_False;
     932             : #endif
     933             : 
     934             :     sal_uLong     nFileStart;            // Offset des SgfHeaders. Im allgemeinen 0.
     935             :     SgfHeader aHead;
     936             :     SgfEntry  aEntr;
     937             :     sal_uLong     nNext;
     938           2 :     sal_Bool      bRdFlag=sal_False;         // Grafikentry gelesen ?
     939           2 :     sal_Bool      bRet=sal_False;            // Returncode
     940             : 
     941           2 :     aIniPath.Append(rtl::OUString("sgf.ini"));
     942             : 
     943           2 :     pSgfFonts = new SgfFontLst;
     944             : 
     945           2 :     pSgfFonts->AssignFN( aIniPath.GetMainURL( INetURLObject::NO_DECODE ) );
     946           2 :     nFileStart=rInp.Tell();
     947           2 :     rInp>>aHead;
     948           2 :     if (aHead.ChkMagic() && aHead.Typ==SgfStarDraw && aHead.Version==SGV_VERSION) {
     949           2 :         nNext=aHead.GetOffset();
     950           8 :         while (nNext && !bRdFlag && !rInp.GetError()) {
     951           4 :             rInp.Seek(nFileStart+nNext);
     952           4 :             rInp>>aEntr;
     953           4 :             nNext=aEntr.GetOffset();
     954           4 :             if (aEntr.Typ==aHead.Typ) {
     955           2 :                 bRet=SgfFilterSDrw( rInp,aHead,aEntr,rMtf );
     956             :             }
     957             :         } // while(nNext)
     958           2 :         if (bRdFlag) {
     959           0 :             if (!rInp.GetError()) bRet=sal_True;  // Scheinbar Ok
     960             :         }
     961             :     }
     962           2 :     delete pSgfFonts;
     963           2 :     return(bRet);
     964             : }
     965             : 
     966             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10