LCOV - code coverage report
Current view: top level - svtools/source/filter - sgvmain.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 170 483 35.2 %
Date: 2012-08-25 Functions: 17 36 47.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 133 603 22.1 %

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

Generated by: LCOV version 1.10