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