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

Generated by: LCOV version 1.10