1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/config.h"
22 #include <osl/thread.h>
24 #include <comphelper/string.hxx>
25 #include <tools/config.hxx>
26 #include <tools/fract.hxx>
27 #include <vcl/graphicfilter.hxx>
28 #include "sgffilt.hxx"
29 #include "sgfbram.hxx"
30 #include "sgvmain.hxx"
31 #include <boost/scoped_array.hpp>
33 extern SgfFontLst
* pSgfFonts
;
36 #define abs(x) ((x)<0 ? -(x) : (x))
39 // Limitations: only grey shadows, 2D and with fixed distance.
40 // Start of AbsBase.Pas
42 // vvv special characters in text buffer vvv
43 #define TextEnd 0 /* ^@ end of character sequence */
44 #define HardSpace 6 /* ^F non-breaking space,' ' */
45 #define SoftTrennK 11 /* ^K character for k-c-switch for separation, 'k' */
46 #define AbsatzEnd 13 /* ^M new paragraph=CR */
47 #define HardTrenn 16 /* ^P hard separator (not wrapped), '-' */
48 #define SoftTrennAdd 19 /* ^S extra-character, separates e.g. "schiff-fahrt" */
49 #define Escape 27 /* ^[ start of escape sequence */
50 #define SoftTrenn 31 /* ^_ soft separator, '-' only end of line */
51 #define MaxEscValLen 8
52 #define MaxEscLen (MaxEscValLen+3)
54 // Escape sequences: [Esc]<Ident><Value>[Esc] at least 4 characters
55 // Max length of value should be: 8 chars (7+sign). Therefore max. length
56 // of a escape sequence: 11 chars.
59 #define EscFont 'F' /* fontID, e.g. 92500 for CG Times */
60 #define EscGrad 'G' /* font angle 1..255 for <<Pt-127<<Pt */
61 #define EscBreit 'B' /* width 1..255% of the font angle */
62 #define EscKaptS 'K' /* uppercase size 1..255% of the text angle */
63 #define EscLFeed 'L' /* character spacing 1..32767% of max. text angle of the line*/
64 // or 1..32767 for 1..16383<<Pt absolute (if bit 15=1)
65 #define EscSlant 'S' /* italic (angle) 1..8999 for 0.01deg..89.99deg */
66 #define EscVPos 'V' /* character vercial position 1..255 for <<Pt..127<<Pt */
67 #define EscZAbst 'Z' /* character spacing -128..127% */
68 #define EscHJust 'A' /* H-justify paragraph: left, cent, right, block, aligned, fixed (0..5)*/
70 #define EscFarbe 'C' /* colour 0..7 */
71 #define EscBFarb 'U' /* background colour 0..7 */
72 #define EscInts 'I' /* colour intensity 0..100% */
73 #define EscMustr 'M' /* pattern 0..? incl. transp... */
74 #define EscMFarb 'O' /* pattern colour 0..7 */
75 #define EscMBFrb 'P' /* 2nd pattern colour 0..7 */
76 #define EscMInts 'W' /* pattern intensity 0..7 */
78 #define EscSMstr 'E' /* shadow pattern 0..? inkl. Transp... */
79 #define EscSFarb 'R' /* shadow colour 0..7 */
80 #define EscSBFrb 'T' /* 2nd shadow colour 0..7 */
81 #define EscSInts 'Q' /* shadow intensity 0..7 */
83 #define EscSXDst 'X' /* shadow offset X 0..100% */
84 #define EscSYDst 'Y' /* shadow offset Y 0..100% */
85 #define EscSDist 'D' /* shadow offset X-Y 0..100% */
87 #define EscBold 'f' /* bold */
88 #define EscLSlnt 'l' /* L italic */
89 #define EscRSlnt 'r' /* R italic */
90 #define EscUndln 'u' /* underlined */
91 #define EscDbUnd 'p' /* double underlined */
92 #define EscKaptF 'k' /* uppercase flag */
93 #define EscStrik 'd' /* strikethrough */
94 #define EscDbStk 'e' /* double strikethrough */
95 #define EscSupSc 'h' /* superscript */
96 #define EscSubSc 't' /* subscript */
97 #define Esc2DShd 's' /* 2D-shadow */
98 #define Esc3DShd 'j' /* 3D-shadow */
99 #define Esc4DShd 'i' /* 4D-shadow */
100 #define EscEbShd 'b' /* embossed */
102 // AllEscIdent =[EscFont, EscGrad, EscBreit,EscKaptS,EscLFeed,EscSlant,EscVPos, EscZAbst,EscHJust,
103 // EscFarbe,EscBFarb,EscInts, EscMustr,EscMFarb,EscMBFrb,EscMInts,
104 // EscSMstr,EscSFarb,EscSBFrb,EscSInts,EscSXDst,EscSYDst,EscSDist,
105 // EscBold, EscLSlnt,EscRSlnt,EscUndln,EscDbUnd,EscKaptF,EscStrik,EscDbStk,
106 // EscSupSc,EscSubSc,Esc2DShd,Esc3DShd,Esc4DShd];
107 // Justify muss spaetestens am Anfang des Absatzes stehen
108 #define EscSet '\x1e' /* set flag */
109 #define EscReset '\x1f' /* reset flag */
110 #define EscDeflt '\x11' /* set flag to default */
111 #define EscToggl '\x1d' /* toggle flag */
113 #define EscNoVal -2147483647 /* -MaxLongInt */
115 #define NoTrenn 0xFFFF /* parameter value for 'Rest' of GetTextChar(), if separation should not occur */
116 #define DoTrenn 0xFFFE /* parameter value for 'Rest' of GetTextChar(), if separtion should occur */
118 #define MaxLineChars 1024
120 #define ChrXPosArrSize (MaxLineChars+1+1) /* 2k - start with 0 opposite to StarDraw */
121 #define CharLineSize (MaxLineChars+1+1)
126 #define CharTopToBase 100 /* due to quotes more as 75% */
127 #define CharTopToBtm 120 /* line height larger as text angle */
128 // for Avanti-Bold 'ue' actually even 130%
130 // end of AbsBase.Pas
132 // Start of DefBase.Pas
134 #define TextBoldBit 0x0001 /* bold */
135 #define TextRSlnBit 0x0002 /* italic */
136 #define TextUndlBit 0x0004 /* underline */
137 #define TextStrkBit 0x0008 /* strikethrough */
138 #define TextSupSBit 0x0010 /* superscript */
139 #define TextSubSBit 0x0020 /* subscript */
140 #define TextKaptBit 0x0040 /* capital */
141 #define TextLSlnBit 0x0080 /* left italic */
142 #define TextDbUnBit 0x0100 /* double underline */
143 #define TextDbStBit 0x0200 /* double strikethrough */
144 #define TextSh2DBit 0x0400 /* 2D-shadow 2.0 */
145 #define TextSh3DBit 0x0800 /* 3D-shadow 2.0 */
146 #define TextSh4DBit 0x1000 /* 4D-shadow 2.0 */
147 #define TextShEbBit 0x2000 /* embossed-shadow 2.0 */
149 #define THJustLeft 0x00
150 #define THJustCenter 0x01
151 #define THJustRight 0x02
152 #define THJustBlock 0x03
153 #define THJustDrvOut 0x04 /* Justified formatted */
154 #define THJustLocked 0x05 /* J u s t l o c k e d */
156 #define MaxCharSlant 4200 /* maximum 42deg italic ! */
158 // end of DefBase.Pas
160 bool CheckTextOutl(ObjAreaType
& F
, ObjLineType
& L
)
162 return (F
.FIntens
!=L
.LIntens
) ||
163 ((F
.FFarbe
!=L
.LFarbe
) && (F
.FIntens
>0)) ||
164 ((F
.FBFarbe
!=L
.LBFarbe
) && (F
.FIntens
<100));
169 short hPoint2Sgf(short a
)
172 b
=long(a
)*127*SgfDpmm
/(144*5);
178 // Start of AbsRead.Pas
180 // Function GetTopToBaseLine() Function GetBaseLineToBtm()
182 // Calculate distance from ascender of line to baseline or from baseline to
183 // descender. All in SGF-units.
185 sal_uInt16
GetTopToBaseLine(sal_uInt16 MaxGrad
)
188 ret
=long(MaxGrad
)*long(CharTopToBase
) /long(100);
189 return sal_uInt16(ret
);
192 // Function GetTextChar() Function GetTextCharConv()
194 // Reads a character from textbuffer, in doing so escape sequences
195 // are evaluated and accordingly the input/output parameter AktAtr is set.
196 // Index is incremented accordingly.
197 // Parameter Rest should always contain the number of characters,
198 // the number of remaining characters in that line.
199 // Otherwise the hyphenation does not work. If the constand NoTrenn
200 // is used instaed, no hyphenation is done. To the contrary then
201 // constant DoTrenn triggers hyphenation where a soft-break is present.
203 // Soft separators are converted to a minus sign.
204 // On top GetTextCharConv() converts HardSpace and AbsatzEnde
205 // in spaces, including HardTrenner in minus signs. TextEnde is
206 // always returned as Char(0).
208 UCHAR
ConvertTextChar(UCHAR c
)
212 case HardSpace
: c
=' '; break;
213 case AbsatzEnd
: c
=' '; break;
214 case SoftTrenn
: c
='-'; break;
215 case HardTrenn
: c
='-'; break;
216 case SoftTrennK
: c
='-'; break;
217 case SoftTrennAdd
: c
='-';
223 long ChgValue(long Def
, long Min
, long Max
, UCHAR FlgVal
, long NumVal
)
227 if (FlgVal
==EscDeflt
) {
228 r
=Def
; // return to default
230 if (NumVal
!=EscNoVal
) r
=NumVal
; // set non-breaking
233 if (Min
!=0 || Max
!=0) {
240 void ChgSchnittBit(sal_uInt16 Bit
, sal_uInt16 Radio1
, sal_uInt16 Radio2
, sal_uInt16 Radio3
,
241 UCHAR FlgVal
, sal_uInt16 Schnitt0
, sal_uInt16
& Schnitt
)
245 Rad
=Radio1
| Radio2
| Radio3
;
249 case EscSet
: Schnitt
=(Schnitt
& ~All
) | Bit
; break;
250 case EscReset
: Schnitt
=(Schnitt
& ~All
); break;
251 case EscDeflt
: Schnitt
=(Schnitt
& ~All
) | (Schnitt0
& All
); break;
252 case EscToggl
: Schnitt
=(Schnitt
& ~Rad
) ^ Bit
;
256 UCHAR
GetNextChar(UCHAR
* TBuf
, sal_uInt16 Index
)
259 while (TBuf
[Index
]==Escape
) {
262 while (TBuf
[Index
]!=Escape
&& Cnt
<=MaxEscLen
) {
269 UCHAR
ProcessOne(UCHAR
* TBuf
, sal_uInt16
& Index
,
270 ObjTextType
& Atr0
, ObjTextType
& AktAtr
,
284 c
=TBuf
[Index
]; Index
++;
287 c
=TBuf
[Index
]; Index
++;
288 Ident
=c
; // remember identifier
291 c
=TBuf
[Index
]; Index
++; // value starts here
292 if (c
==EscSet
|| c
==EscReset
|| c
==EscDeflt
|| c
==EscToggl
) FlgVal
=c
; else {
293 if (c
=='-') Sgn
=-1; else Sgn
=1;
294 if (c
=='+' || c
=='-') { c
=TBuf
[Index
]; Index
++; }
298 NumVal
=10*NumVal
+c
-'0';
299 EoVal
=(TBuf
[Index
]<'0' || TBuf
[Index
]>'9');
300 if (!EoVal
) { c
=TBuf
[Index
]; Index
++; }
302 } while (i
>0 && !EoVal
);
305 q
=!CheckTextOutl(AktAtr
.F
,AktAtr
.L
);
308 case EscFont
: AktAtr
.SetFont(sal_uLong (ChgValue(Atr0
.GetFont(),0,0 ,FlgVal
,NumVal
)));break;
309 case EscGrad
: AktAtr
.Grad
=sal_uInt16(ChgValue(Atr0
.Grad
, 2,2000 ,FlgVal
,NumVal
)); break;
310 case EscBreit
: AktAtr
.Breite
=sal_uInt16(ChgValue(Atr0
.Breite
, 1,1000 ,FlgVal
,NumVal
)); break;
311 case EscKaptS
: AktAtr
.Kapit
=(sal_uInt8
)(ChgValue(Atr0
.Kapit
, 1,255 ,FlgVal
,NumVal
)); break;
312 case EscLFeed
: AktAtr
.LnFeed
=sal_uInt16(ChgValue(Atr0
.LnFeed
, 1,65535 ,FlgVal
,NumVal
)); break;
313 case EscSlant
: AktAtr
.Slant
=sal_uInt16(ChgValue(Atr0
.Slant
, 1,MaxCharSlant
,FlgVal
,NumVal
)); break;
314 case EscVPos
: AktAtr
.ChrVPos
=char (ChgValue(Atr0
.ChrVPos
,-128,127 ,FlgVal
,NumVal
)); break;
315 case EscZAbst
: AktAtr
.ZAbst
=(sal_uInt8
)(ChgValue(Atr0
.ZAbst
, 1,255 ,FlgVal
,NumVal
)); break;
316 case EscHJust
: AktAtr
.Justify
=(sal_uInt8
)(ChgValue(Atr0
.Justify
& 0x0F,0,5 ,FlgVal
,NumVal
)); break;
317 case EscFarbe
: { AktAtr
.L
.LFarbe
=(sal_uInt8
)(ChgValue(Atr0
.L
.LFarbe
,0,7 ,FlgVal
,NumVal
)); if (q
) AktAtr
.F
.FFarbe
=AktAtr
.L
.LFarbe
; } break;
318 case EscBFarb
: { AktAtr
.L
.LBFarbe
=(sal_uInt8
)(ChgValue(Atr0
.L
.LBFarbe
,0,255,FlgVal
,NumVal
)); if (q
) AktAtr
.F
.FBFarbe
=AktAtr
.L
.LBFarbe
; } break;
319 case EscInts
: { AktAtr
.L
.LIntens
=(sal_uInt8
)(ChgValue(Atr0
.L
.LIntens
,0,100,FlgVal
,NumVal
)); if (q
) AktAtr
.F
.FIntens
=AktAtr
.L
.LIntens
; } break;
321 case EscMustr
: { AktAtr
.F
.FMuster
=sal_uInt16(ChgValue(Atr0
.F
.FMuster
,0,65535,FlgVal
,NumVal
)); } break;
322 case EscMFarb
: { AktAtr
.F
.FFarbe
=(sal_uInt8
)(ChgValue(Atr0
.F
.FFarbe
,0,7 ,FlgVal
,NumVal
)); } break;
323 case EscMBFrb
: { AktAtr
.F
.FBFarbe
=(sal_uInt8
)(ChgValue(Atr0
.F
.FBFarbe
,0,255,FlgVal
,NumVal
)); } break;
324 case EscMInts
: { AktAtr
.F
.FIntens
=(sal_uInt8
)(ChgValue(Atr0
.F
.FIntens
,0,100,FlgVal
,NumVal
)); } break;
326 case EscSMstr
: { AktAtr
.ShdF
.FMuster
=sal_uInt16(ChgValue(Atr0
.ShdF
.FMuster
,0,65535,FlgVal
,NumVal
)); } break;
327 case EscSFarb
: { AktAtr
.ShdL
.LFarbe
=(sal_uInt8
)(ChgValue(Atr0
.ShdL
.LFarbe
,0,7 ,FlgVal
,NumVal
)); AktAtr
.ShdF
.FFarbe
=AktAtr
.ShdL
.LFarbe
; } break;
328 case EscSBFrb
: { AktAtr
.ShdL
.LBFarbe
=(sal_uInt8
)(ChgValue(Atr0
.ShdL
.LBFarbe
,0,255,FlgVal
,NumVal
)); AktAtr
.ShdF
.FBFarbe
=AktAtr
.ShdL
.LBFarbe
; } break;
329 case EscSInts
: { AktAtr
.ShdL
.LIntens
=(sal_uInt8
)(ChgValue(Atr0
.ShdL
.LIntens
,0,100,FlgVal
,NumVal
)); AktAtr
.ShdF
.FIntens
=AktAtr
.ShdL
.LIntens
; } break;
330 case EscSDist
: { AktAtr
.ShdVers
.x
=(short)ChgValue(Atr0
.ShdVers
.x
,0,30000,FlgVal
,NumVal
); AktAtr
.ShdVers
.y
=AktAtr
.ShdVers
.x
; } break;
331 case EscSXDst
: { AktAtr
.ShdVers
.x
=(short)ChgValue(Atr0
.ShdVers
.x
,0,30000,FlgVal
,NumVal
); } break;
332 case EscSYDst
: { AktAtr
.ShdVers
.y
=(short)ChgValue(Atr0
.ShdVers
.y
,0,30000,FlgVal
,NumVal
); } break;
334 case EscBold
: ChgSchnittBit(TextBoldBit
,0,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
335 case EscRSlnt
: ChgSchnittBit(TextRSlnBit
,TextLSlnBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
336 case EscUndln
: ChgSchnittBit(TextUndlBit
,TextDbUnBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
337 case EscStrik
: ChgSchnittBit(TextStrkBit
,TextDbStBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
338 case EscDbUnd
: ChgSchnittBit(TextDbUnBit
,TextUndlBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
339 case EscDbStk
: ChgSchnittBit(TextDbStBit
,TextStrkBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
340 case EscSupSc
: ChgSchnittBit(TextSupSBit
,TextSubSBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
341 case EscSubSc
: ChgSchnittBit(TextSubSBit
,TextSupSBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
342 case EscKaptF
: ChgSchnittBit(TextKaptBit
,0,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
343 case EscLSlnt
: ChgSchnittBit(TextLSlnBit
,TextRSlnBit
,0,0 ,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
344 case Esc2DShd
: ChgSchnittBit(TextSh2DBit
,TextSh3DBit
,TextSh4DBit
,TextShEbBit
,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
345 case Esc3DShd
: ChgSchnittBit(TextSh3DBit
,TextSh2DBit
,TextSh4DBit
,TextShEbBit
,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
346 case Esc4DShd
: ChgSchnittBit(TextSh4DBit
,TextSh2DBit
,TextSh3DBit
,TextShEbBit
,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
347 case EscEbShd
: ChgSchnittBit(TextShEbBit
,TextSh2DBit
,TextSh3DBit
,TextSh4DBit
,FlgVal
,Atr0
.Schnitt
,AktAtr
.Schnitt
); break;
349 if (TBuf
[Index
]==Escape
) Index
++; // read 2nd escape }
351 } while (!Ende
&& !ScanEsc
);
354 } // end of ProcessOne
356 UCHAR
GetTextChar(UCHAR
* TBuf
, sal_uInt16
& Index
,
357 ObjTextType
& Atr0
, ObjTextType
& AktAtr
,
358 sal_uInt16 Rest
, bool ScanEsc
)
360 UCHAR c
=ProcessOne(TBuf
,Index
,Atr0
,AktAtr
,ScanEsc
);
362 if (c
==SoftTrennAdd
|| c
==SoftTrennK
|| c
==SoftTrenn
) {
363 UCHAR nc
=GetNextChar(TBuf
,Index
);
365 if (Rest
==0 || Rest
==DoTrenn
||
366 nc
==' ' || nc
==AbsatzEnd
|| nc
==TextEnd
) c
='-';
368 c
=ProcessOne(TBuf
,Index
,Atr0
,AktAtr
,ScanEsc
); // skip separator
369 if (c0
==SoftTrennAdd
) {
370 if (c
>=32) c
=ProcessOne(TBuf
,Index
,Atr0
,AktAtr
,ScanEsc
); // skip another letter
374 if ((Rest
==1 || Rest
==DoTrenn
) && GetNextChar(TBuf
,Index
)==SoftTrennK
) {
376 else if (c
=='C') c
='K';
382 // HardSpace and HardTrenn should be converted explicitely ! }
383 // if AktAtr.Schnitt and TextKaptBit =TextKaptBit then c:=UpCase(c);(explizit) }
385 // The separationmethod SoftTrennAdd assumes, the separating consonant }
386 // is 3x present in TextBuf, e.g.: "schiff-fahrt". }
387 // If not separated then, "-f" is removed. }
389 UCHAR
GetTextCharConv(UCHAR
* TBuf
, sal_uInt16
& Index
,
390 ObjTextType
& Atr0
, ObjTextType
& AktAtr
,
391 sal_uInt16 Rest
, bool ScanEsc
)
395 c
=GetTextChar(TBuf
,Index
,Atr0
,AktAtr
,Rest
,ScanEsc
);
398 case HardSpace
: c
=' '; break;
399 case AbsatzEnd
: c
=' '; break;
400 case HardTrenn
: c
='-';
406 // Function GetLineFeed()
408 // Required line spacing in SGF-Units. ChrVPos is taken into account.
409 // ======================================================================
410 sal_uInt16
GetLineFeed(UCHAR
* TBuf
, sal_uInt16 Index
, ObjTextType Atr0
, ObjTextType AktAtr
,
411 sal_uInt16 nChar
, sal_uInt16
& LF
, sal_uInt16
& MaxGrad
)
415 sal_uLong MaxLF100
=0;
423 while (!AbsEnd
&& nChar
>0) {
425 UCHAR c
=GetTextChar(TBuf
,Index
,Atr0
,AktAtr
,nChar
,false);
427 AbsEnd
=(c
==TextEnd
|| c
==AbsatzEnd
);
428 if (First
|| (!AbsEnd
&& c
!=' ' && c
!=HardTrenn
)) {
429 LFauto
=(AktAtr
.LnFeed
& 0x8000)==0;
430 LF100
=AktAtr
.LnFeed
& 0x7FFF;
431 if (LFauto
) LF100
=LF100
*AktAtr
.Grad
; else LF100
*=LF100
;
432 if (AktAtr
.ChrVPos
>0) LF100
-=AktAtr
.ChrVPos
*100;
433 if (LF100
>MaxLF100
) MaxLF100
=LF100
;
435 if (AktAtr
.ChrVPos
>0) Grad
=Grad
-AktAtr
.ChrVPos
;
436 if (Grad
>MaxGrad
) MaxGrad
=Grad
;
439 if (!AbsEnd
&& c
!=' ') r
=i
;
441 MaxGrad
=hPoint2Sgf(MaxGrad
);
442 if (MaxLF100
<=4000) { // otherwise overflow could occur
443 LF
=sal_uInt16(hPoint2Sgf(short(MaxLF100
)) /100);
445 LF
=sal_uInt16(hPoint2Sgf(short(MaxLF100
) /100));
451 // End of AbsRead.Pas
453 // Start of iFont.Pas
455 #define SuperSubFact 60 /* superscript/subscript: 60% of text angle */
456 #define DefaultSpace 40 /* Default: space is 40% of text angle */
458 sal_uInt16
SetTextContext(OutputDevice
& rOut
, ObjTextType
& Atr
, bool Kapt
, sal_uInt16 nRotation
,
459 sal_uInt16 FitXMul
, sal_uInt16 FitXDiv
, sal_uInt16 FitYMul
, sal_uInt16 FitYDiv
)
461 SgfFontOne
* pSgfFont
; // Font from the IniFile
467 sal_uInt16 StdBrei
=50; // average line width in % of text angle
468 bool bFit
=(FitXMul
!=1 || FitXDiv
!=1 || FitYMul
!=1 || FitYDiv
!=1);
470 pSgfFont
= pSgfFonts
->GetFontDesc(Atr
.GetFont());
472 if ( pSgfFont
!=NULL
)
474 FNam
=pSgfFont
->SVFName
;
475 StdBrei
=pSgfFont
->SVWidth
;
476 if (pSgfFont
->Fixd
) aFont
.SetPitch(PITCH_FIXED
); else aFont
.SetPitch(PITCH_VARIABLE
);
477 aFont
.SetFamily(pSgfFont
->SVFamil
);
478 aFont
.SetCharSet(pSgfFont
->SVChSet
);
482 { // if not in Inifile, some fonts are hard coded here
483 aFont
.SetPitch(PITCH_VARIABLE
);
484 switch (Atr
.GetFont()) {
485 case 92500: case 92501: case 92504: case 92505:
488 FNam
= "Times New Roman"; // CG Times is Times New Roman in Windows
490 FNam
= "Times"; // otherwise just Times
493 aFont
.SetFamily(FAMILY_ROMAN
);
495 case 94021: case 94022: case 94023: case 94024: {
497 FNam
= "Arial"; // Univers is Arial in Windows
499 FNam
= "Helvetica"; // otherwise Helvetica
501 aFont
.SetFamily(FAMILY_SWISS
);
504 case 93950: case 93951: case 93952: case 93953: {
506 FNam
= "Courier New"; // The vector-Courierfont is called Courier New in Windows
508 FNam
= "Courier"; // otherwise Courier remains Courier
510 aFont
.SetFamily(FAMILY_ROMAN
);
511 aFont
.SetPitch(PITCH_FIXED
);
513 default: FNam
= "Helvetica";
516 //aFont.SetCharSet(CHARSET_SYSTEM);
519 Grad
=sal_uLong(Atr
.Grad
);
520 if ((Atr
.Schnitt
& TextKaptBit
) !=0 && Kapt
) Grad
=Grad
*sal_uLong(Atr
.Kapit
)/100;
521 if ((Atr
.Schnitt
& TextSupSBit
) !=0 || (Atr
.Schnitt
& TextSubSBit
) !=0) Grad
=Grad
*SuperSubFact
/100;
523 if (Atr
.Breite
!=100 || bFit
) {
525 Grad
=Grad
*sal_uLong(FitYMul
)/sal_uLong(FitYDiv
);
526 Brei
=Brei
*sal_uLong(FitXMul
)/sal_uLong(FitXDiv
);
528 Brei
=Brei
*sal_uLong(Atr
.Breite
)/100;
529 Brei
=Brei
*sal_uLong(StdBrei
)/100;
530 aFont
.SetSize(Size(hPoint2Sgf(sal_uInt16(Brei
)),hPoint2Sgf(sal_uInt16(Grad
))));
532 aFont
.SetSize(Size(0,hPoint2Sgf(sal_uInt16(Grad
))));
535 aColor
=Sgv2SvFarbe(Atr
.L
.LFarbe
,Atr
.L
.LBFarbe
,Atr
.L
.LIntens
); aFont
.SetColor(aColor
);
536 aColor
=Sgv2SvFarbe(Atr
.F
.FFarbe
,Atr
.F
.FBFarbe
,Atr
.F
.FIntens
); aFont
.SetFillColor(aColor
);
537 aFont
.SetTransparent(true);
538 aFont
.SetAlign(ALIGN_BASELINE
);
540 nRotation
/=10; nRotation
=3600-nRotation
; if (nRotation
==3600) nRotation
=0;
541 aFont
.SetOrientation(nRotation
);
543 if ((Atr
.Schnitt
& TextBoldBit
) !=0) aFont
.SetWeight(WEIGHT_BOLD
);
544 if ((Atr
.Schnitt
& TextRSlnBit
) !=0) aFont
.SetItalic(ITALIC_NORMAL
);
545 if ((Atr
.Schnitt
& TextUndlBit
) !=0) aFont
.SetUnderline(UNDERLINE_SINGLE
);
546 if ((Atr
.Schnitt
& TextDbUnBit
) !=0) aFont
.SetUnderline(UNDERLINE_DOUBLE
);
547 if ((Atr
.Schnitt
& TextStrkBit
) !=0) aFont
.SetStrikeout(STRIKEOUT_SINGLE
);
548 if ((Atr
.Schnitt
& TextDbStBit
) !=0) aFont
.SetStrikeout(STRIKEOUT_DOUBLE
);
549 if ((Atr
.Schnitt
& TextSh2DBit
) !=0) aFont
.SetShadow(true);
550 if ((Atr
.Schnitt
& TextSh3DBit
) !=0) aFont
.SetShadow(true);
551 if ((Atr
.Schnitt
& TextSh4DBit
) !=0) aFont
.SetShadow(true);
552 if ((Atr
.Schnitt
& TextShEbBit
) !=0) aFont
.SetShadow(true);
553 if (CheckTextOutl(Atr
.F
,Atr
.L
)) aFont
.SetOutline(true);
555 if (aFont
!=rOut
.GetFont()) rOut
.SetFont(aFont
);
562 // Start of Absatz.Pas
572 void InitProcessCharState(ProcChrSta
& State
, ObjTextType
& AktAtr
, sal_uInt16 IndexA
)
581 bool UpcasePossible(UCHAR c
)
583 return ((c
>='a' && c
<='z') || c
== 0xe4 || c
== 0xf6 || c
== 0xfc );
586 UCHAR
Upcase(UCHAR c
)
588 if ((c
>=(UCHAR
)'a' && c
<=(UCHAR
)'z')) c
=(c
-(UCHAR
)'a')+(UCHAR
)'A';
589 else if ( c
== 0xe4 ) c
= 0xc4;
590 else if ( c
== 0xf6 ) c
= 0xd6;
591 else if ( c
== 0xfc ) c
= 0xdc;
595 sal_uInt16
GetCharWidth(OutputDevice
& rOut
, UCHAR c
)
601 ChrWidth
=(sal_uInt16
)rOut
.GetTextWidth( OUString('A') );
602 if (rOut
.GetFont().GetPitch()!=PITCH_FIXED
) {
603 ChrWidth
=MulDiv(ChrWidth
,DefaultSpace
,100);
608 static_assert(MaxChar
== 255, "with MaxChar == 255 c cannot be greater than MaxChar");
609 static_assert(sizeof(UCHAR
) == 1, "assert if MaxChar type is ever changed");
610 if (c
>=MinChar
/*&& c<=MaxChar*/)
612 ChrWidth
=(sal_uInt16
)rOut
.GetTextWidth(OUString(reinterpret_cast<sal_Char
*>(&c
), 1, RTL_TEXTENCODING_IBM_437
));
616 ChrWidth
=(sal_uInt16
)rOut
.GetTextWidth(OUString(static_cast<sal_Unicode
>('A')));
622 UCHAR
ProcessChar(OutputDevice
& rOut
, UCHAR
* TBuf
, ProcChrSta
& R
, ObjTextType
& Atr0
,
623 sal_uInt16
& nChars
, sal_uInt16 Rest
,
624 short* Line
, UCHAR
* cLine
)
626 sal_uInt16 KernDist
=0; // value for kerning
631 c
=GetTextChar(TBuf
,R
.Index
,Atr0
,R
.Attrib
,Rest
,false); // tries to separate, if Rest contains appropriate value
633 AbsEnd
=(c
==AbsatzEnd
|| c
==TextEnd
);
635 R
.OutCh
=ConvertTextChar(c
); // from HardTrenn to '-', ...
636 R
.Kapt
=(R
.Attrib
.Schnitt
& TextKaptBit
) !=0 && UpcasePossible(R
.OutCh
);
637 if (R
.Kapt
) R
.OutCh
=Upcase(R
.OutCh
);
638 SetTextContext(rOut
,R
.Attrib
,R
.Kapt
,0,1,1,1,1);
640 UCHAR c1
= (R
.Kapt
)?Upcase(c
):c
;
641 ChrWidth
=GetCharWidth(rOut
,c1
);
643 if (R
.Attrib
.ZAbst
!=100) { // special line distance ?
645 Temp
=sal_uLong(ChrWidth
)*sal_uLong(R
.Attrib
.ZAbst
)/100;
646 ChrWidth
=sal_uInt16(Temp
);
649 if (R
.ChrXP
>32000) R
.ChrXP
=32000;
650 Line
[nChars
]=R
.ChrXP
-KernDist
;
652 R
.ChrXP
+=ChrWidth
-KernDist
; // position of next character
657 void FormatLine(UCHAR
* TBuf
, sal_uInt16
& Index
, ObjTextType
& Atr0
, ObjTextType
& AktAtr
,
658 sal_uInt16 UmbWdt
, sal_uInt16 AdjWdt
,
659 short* Line
, sal_uInt16
& nChars
,
661 UCHAR
* cLine
, bool TextFit
)
663 ScopedVclPtrInstance
< VirtualDevice
> vOut
;
665 bool First
; // first char ?
666 sal_uInt8 Just
= 0; // paragraph format
667 bool Border
; // border of box reached ?
669 bool AbsEnd
; // end of paragraph reached ?
670 ProcChrSta
* R
=new ProcChrSta
;
671 ProcChrSta
* R0
=new ProcChrSta
;
672 ProcChrSta
* WErec
=new ProcChrSta
;
674 ProcChrSta
* WErec0
=new ProcChrSta
;
676 ProcChrSta
* TRrec
=new ProcChrSta
;
679 sal_uInt16 WordEndCnt
; // justify and separate
683 short BoxRest
; // to crush and format
687 vOut
->SetMapMode(MapMode(MAP_10TH_MM
,Point(),Fraction(1,4),Fraction(1,4)));
690 SetTextContext(*vOut
.get(),AktAtr
,false,0,1,1,1,1);
691 InitProcessCharState(*R
,AktAtr
,Index
);
692 (*R0
)=(*R
); (*WErec
)=(*R
); WEnChar
=0; c0
=0; Border0
=false;
693 Border
=false; First
=true;
696 do { // check how many words to on that line
697 if (Border
) c
=ProcessChar(*vOut
.get(),TBuf
,*R
,Atr0
,nChars
,DoTrenn
,Line
,cLine
);
698 else c
=ProcessChar(*vOut
.get(),TBuf
,*R
,Atr0
,nChars
,NoTrenn
,Line
,cLine
);
699 AbsEnd
=(c
==AbsatzEnd
|| c
==TextEnd
);
703 Just
=R
->Attrib
.Justify
& 0x0F; // paragraph format remains, then at start
705 Border
=R
->ChrXP
>UmbWdt
;
706 WordEnd
=(AbsEnd
|| (c
==' ')) && (c0
!=' ') && (c0
!=0);
708 if (WordEnd
&& !Border0
) {
713 if (Trenn
&& !Border
) {
722 AbsEnd
=AbsEnd
|| (nChars
>=MaxLineChars
);
723 } while (!(AbsEnd
|| (Border
&& ((WordEndCnt
>0) || WordEnd
|| Trenn
))));
725 if (Border
) { // separate and crush
726 (*WErec0
)=(*WErec
); WEnChar0
=WEnChar
;
728 (*R
)=(*WErec
); nChars
=WEnChar
;
729 (*TRrec
)=(*R
); TRnChar
=nChars
;
730 Border0
=false; Border
=false;
731 do { // first check how many syllables fit
732 UCHAR ct
=ProcessChar(*vOut
.get(),TBuf
,*TRrec
,Atr0
,TRnChar
,DoTrenn
,Line
,cLine
);
733 c
=ProcessChar(*vOut
.get(),TBuf
,*R
,Atr0
,nChars
,NoTrenn
,Line
,cLine
);
734 AbsEnd
=(ct
==AbsatzEnd
) || (ct
==TextEnd
) || (nChars
>=MaxLineChars
);
736 Border
=TRrec
->ChrXP
>UmbWdt
;
737 WordEnd
=AbsEnd
|| ((AbsEnd
|| (c
==' ')) && (c0
!=' ') && (c0
!=0));
739 if (WordEnd
&& (!Border0
|| (WordEndCnt
==0))) {
742 if (AbsEnd
) WEnChar
=nChars
; else WEnChar
=nChars
-1;
743 (*TRrec
)=(*R
); TRnChar
=nChars
; // to continue searching
745 if (Trenn
&& (!Border
|| (WordEndCnt
==0))) {
746 WordEndCnt
++; // remember we can separate here
749 (*TRrec
)=(*R
); TRnChar
=nChars
; // continue searching
753 Border
=R
->ChrXP
>UmbWdt
;
754 } while (!(AbsEnd
|| (Border
&& ((WordEndCnt
>0) || WordEnd
|| Trenn
))));
756 while (WErec0
->Index
<WErec
->Index
) { // to assure Line[] matches }
757 ProcessChar(*vOut
.get(),TBuf
,*WErec0
,Atr0
,WEnChar0
,WEnChar
-WEnChar0
-1,Line
,cLine
);
760 (*R
)=(*WErec
); nChars
=WEnChar
;
762 if (UmbWdt
<R
->ChrXP
) {
763 BoxRest
=R
->ChrXP
-UmbWdt
; // so much should be crushed
764 for (i
=2;i
<=nChars
;i
++) { // first character position remains!
765 Line
[i
]-=(i
-1)*(BoxRest
) /(nChars
-1);
768 Line
[nChars
+1]=UmbWdt
;
773 do { // read empty characters
775 c
=GetTextChar(TBuf
,R
->Index
,Atr0
,R
->Attrib
,NoTrenn
,false);
777 Line
[nChars
]=R
->ChrXP
;
780 if (c
!=' ' && c
!=AbsatzEnd
&& c
!=TextEnd
) {
786 if (AbsEnd
&& nChars
<MaxLineChars
) { // align, left aligned instead of block
788 nChars
++; Line
[nChars
]=R
->ChrXP
; // to assure AbsatzEnde is read
789 Line
[nChars
+1]=R
->ChrXP
; // as the width of CR or #0 is very small
790 if (TBuf
[R
->Index
-1]!=AbsatzEnd
&& TBuf
[R
->Index
-1]!=TextEnd
) {
791 c
=GetTextChar(TBuf
,R
->Index
,Atr0
,R
->Attrib
,NoTrenn
,false); // small correction needed, if 1st word read
795 BoxRest
=AdjWdt
-R
->ChrXP
;
796 if (TextFit
) Just
=THJustLeft
;
799 case THJustLeft
: break; // left
801 BoxRest
=BoxRest
/2; // middle
802 for (i
=1;i
<=nChars
;i
++) Line
[i
]=Line
[i
]+BoxRest
;
804 case THJustRight
: { // right
805 for (i
=1;i
<=nChars
;i
++) Line
[i
]=Line
[i
]+BoxRest
;
808 case THJustBlock
: { // block and justified
810 if (Just
==THJustDrvOut
) re
--;
811 while (re
>=1 && (cLine
[re
]==' ' || cLine
[re
]==TextEnd
|| cLine
[re
]==AbsatzEnd
)) re
--;
813 while (li
<=re
&& (cLine
[li
]==' ' || cLine
[li
]==TextEnd
|| cLine
[li
]==AbsatzEnd
)) li
++;
814 if (Just
==THJustDrvOut
) BoxRest
=AdjWdt
-Line
[re
+1];
816 j
=0; // get number of spaces
817 for (i
=li
;i
<=re
;i
++) {
823 if (j
==0) { // only one word ? -> stretch !
824 for (i
=li
+1;i
<=re
;i
++) { // from left to right
825 Line
[i
]=Line
[i
]+MulDiv(i
-li
,BoxRest
,re
-li
+1-1);
829 for (i
=li
;i
<=re
;i
++) { // j drill spaces !
830 if (cLine
[i
]==' ') { // space found !
832 h
=MulDiv(k
,BoxRest
,j
);
837 for (i
=re
+1;i
<=nChars
;i
++) Line
[i
]=Line
[i
]+BoxRest
; // adapt the rest
838 Line
[nChars
+1]=AdjWdt
;
840 case THJustLocked
: { // locked out
842 while (re
>=1 && (cLine
[re
]==' ' || cLine
[re
]==TextEnd
|| cLine
[re
]==AbsatzEnd
)) re
--;
844 while (li
<=re
&& (cLine
[li
]==' ' || cLine
[li
]==TextEnd
|| cLine
[li
]==AbsatzEnd
)) li
++;
845 BoxRest
=AdjWdt
-Line
[re
+1];
846 for (i
=li
+1;i
<=re
;i
++) { // stretch from left to right
847 Line
[i
]=Line
[i
]+MulDiv(i
-li
,BoxRest
,re
-li
+1-1);
849 for (i
=re
+1;i
<=nChars
;i
++) Line
[i
]=Line
[i
]+BoxRest
; // adapt the rest
850 Line
[nChars
+1]=AdjWdt
;
864 // Start of DrawText.Pas
866 void DrawChar(OutputDevice
& rOut
, UCHAR c
, ObjTextType T
, PointType Pos
, sal_uInt16 RotationAngle
,
867 sal_uInt16 FitXMul
, sal_uInt16 FitXDiv
, sal_uInt16 FitYMul
, sal_uInt16 FitYDiv
)
869 SetTextContext(rOut
,T
,UpcasePossible(c
),RotationAngle
,FitXMul
,FitXDiv
,FitYMul
,FitYDiv
);
870 if ((T
.Schnitt
& TextKaptBit
)!=0 && UpcasePossible(c
)) c
=Upcase(c
);
871 OUString
s(reinterpret_cast<const sal_Char
*>(&c
), 1,
872 RTL_TEXTENCODING_IBM_437
);
873 rOut
.DrawText( Point( Pos
.x
, Pos
.y
), s
);
876 void TextType::Draw(OutputDevice
& rOut
)
878 if ((Flags
& TextOutlBit
)!=0) return; // source text for Outliner !!
884 sal_uInt16 l
; // number of characters on the line
895 sal_uInt16 TopToBase
;
899 boost::scoped_array
<short> xLine
;
900 boost::scoped_array
<UCHAR
> cLine
; // Buffer for FormatLine
906 UCHAR
* Buf
=Buffer
; // pointer to the letters
908 pSgfFonts
->ReadList();
909 xLine
.reset(new short[ChrXPosArrSize
]);
910 cLine
.reset(new UCHAR
[CharLineSize
]);
912 TextFit
=(Flags
& TextFitBits
)!=0;
913 bool LineFit
=((Flags
& TextFitZBit
)!=0); // FitSize.x=0? or flags -> stretch each line
914 if (TextFit
&& FitSize
.x
==0) LineFit
=true;
916 if (RotationAngle
==0) {
920 sn
=sin(double(RotationAngle
)*3.14159265359/18000);
921 cs
=cos(double(RotationAngle
)*3.14159265359/18000);
924 T1
=T
; Index1
=0; yPos
=0; xPos
=0;
927 xSize
=32000 /2; // break
928 xSAdj
=Pos2
.x
-Pos1
.x
; // to align for center/block
929 //if (xSize<=0) { xSize=32000 /2; LineFit=true; }
930 FitXMul
=sal::static_int_cast
< sal_uInt16
>(abs(Pos2
.x
-Pos1
.x
)); FitXDiv
=FitSize
.x
; if (FitXDiv
==0) FitXDiv
=1;
931 FitYMul
=sal::static_int_cast
< sal_uInt16
>(abs(Pos2
.y
-Pos1
.y
)); FitYDiv
=FitSize
.y
; if (FitYDiv
==0) FitYDiv
=1;
936 FitXMul
=1; FitXDiv
=1;
937 FitYMul
=1; FitYDiv
=1;
939 if (xSize
<0) xSize
=0;
940 if (xSAdj
<0) xSAdj
=0;
943 T2
=T1
; Index2
=Index1
;
944 FormatLine(Buf
,Index2
,T
,T2
,xSize
,xSAdj
,xLine
.get(),l
,sn
,cs
,cLine
.get(),LineFit
);
945 Fehler
=(Index2
==Index1
);
947 lc
=GetLineFeed(Buf
,Index1
,T
,T1
,l
,LF
,MaxGrad
);
949 if (LineFit
) FitXDiv
=xLine
[lc
+1];
951 for (i
=1;i
<=l
+1;i
++) {
952 const long Temp
=long(xLine
[i
])*long(FitXMul
) /long(FitXDiv
);
953 xLine
[i
]=short(Temp
);
955 LF
=MulDiv(LF
,FitYMul
,FitYDiv
);
956 MaxGrad
=MulDiv(MaxGrad
,FitYMul
,FitYDiv
);
958 FitXDiv
=1; // 0 does not exist
962 TopToBase
=GetTopToBaseLine(MaxGrad
);
964 Ende
=(yPos0
+short(MulDiv(MaxGrad
,CharTopToBtm
,100))>ySize
) && !TextFit
;
966 T2
=T1
; Index2
=Index1
;
969 c
=GetTextCharConv(Buf
,Index2
,T
,T2
,l
-i
,false);
970 long xp1
,yp1
; // due to overflow danger
972 xp1
=long(Pos1
.x
)+xPos
+long(xLine
[i
]);
973 yp1
=long(Pos1
.y
)+yPos
;
974 if (xp1
>32000) xp1
=32000; if (xp1
<-12000) xp1
=-12000;
975 if (yp1
>32000) yp1
=32000; if (yp1
<-12000) yp1
=-12000;
979 if (RotationAngle
!=0) RotatePoint(Pos
,Pos1
.x
,Pos1
.y
,sn
,cs
);
980 DrawChar(rOut
,c
,T2
,Pos
,RotationAngle
,FitXMul
,FitXDiv
,FitYMul
,FitYDiv
);
984 T1
=T2
; Index1
=Index2
; // for next line
985 } // if ObjMin.y+yPos<=Obj_Max.y
987 } while (c
!=TextEnd
&& !Ende
&& !Fehler
);
990 // End of DrawText.Pas
992 sal_uInt32
ObjTextType::GetFont()
994 return sal_uLong(FontLo
)+0x00010000*sal_uLong(FontHi
);
997 void ObjTextType::SetFont(sal_uInt32 FontID
)
999 FontLo
=sal_uInt16(FontID
& 0x0000FFFF);
1000 FontHi
=sal_uInt16((FontID
& 0xFFFF0000)>>16);
1004 SgfFontOne::SgfFontOne()
1013 SVFamil
=FAMILY_DONTKNOW
;
1014 SVChSet
=RTL_TEXTENCODING_DONTKNOW
;
1018 void SgfFontOne::ReadOne( const OString
& rID
, OString
& Dsc
)
1020 if ( Dsc
.getLength() < 4 || ( Dsc
[0] != '(' ) )
1022 sal_Int32 i
=1; // first letter of IF fontname. In front is a '('
1023 while ( i
< Dsc
.getLength() && ( Dsc
[i
] !=')' ) )
1025 Dsc
= Dsc
.copy(i
+1); // delete IF fontname incl. ()
1027 if ( Dsc
.getLength() < 2 || ( Dsc
[Dsc
.getLength() - 1] !=')' ) )
1029 i
= Dsc
.getLength()-2; // here is the ')' of the SV fontname
1031 while ( i
> 0 && ( Dsc
[i
] != '(' ) )
1036 SVFName
= OStringToOUString(Dsc
.copy(i
+1,j
), RTL_TEXTENCODING_IBM_437
); // retrieve SV fontname
1037 Dsc
= OStringBuffer(Dsc
).remove(i
,j
).makeStringAndClear();
1039 IFID
= (sal_uInt32
)rID
.toInt32();
1040 sal_Int32 nTokenCount
= comphelper::string::getTokenCount(Dsc
, ' ');
1041 for (sal_Int32 nIdx
= 0; nIdx
< nTokenCount
; ++nIdx
)
1043 OString
s(Dsc
.getToken(nIdx
, ' '));
1046 s
= s
.toAsciiUpperCase();
1047 if (s
.match("BOLD")) Bold
=true;
1048 else if (s
.match("ITAL")) Ital
=true;
1049 else if (s
.match("SERF")) Serf
=true;
1050 else if (s
.match("SANS")) Sans
=true;
1051 else if (s
.match("FIXD")) Fixd
=true;
1052 else if (s
.match("ROMAN")) SVFamil
=FAMILY_ROMAN
;
1053 else if (s
.match("SWISS")) SVFamil
=FAMILY_SWISS
;
1054 else if (s
.match("MODERN")) SVFamil
=FAMILY_MODERN
;
1055 else if (s
.match("SCRIPT")) SVFamil
=FAMILY_SCRIPT
;
1056 else if (s
.match("DECORA")) SVFamil
=FAMILY_DECORATIVE
;
1057 else if (s
.match("ANSI")) SVChSet
=RTL_TEXTENCODING_MS_1252
;
1058 else if (s
.match("IBMPC")) SVChSet
=RTL_TEXTENCODING_IBM_850
;
1059 else if (s
.match("MAC")) SVChSet
=RTL_TEXTENCODING_APPLE_ROMAN
;
1060 else if (s
.match("SYMBOL")) SVChSet
=RTL_TEXTENCODING_SYMBOL
;
1061 else if (s
.match("SYSTEM")) SVChSet
= osl_getThreadTextEncoding();
1062 else if (comphelper::string::isdigitAsciiString(s
) ) SVWidth
=sal::static_int_cast
< sal_uInt16
>(s
.toInt32());
1067 SgfFontLst::SgfFontLst()
1076 SgfFontLst::~SgfFontLst()
1081 void SgfFontLst::RausList()
1098 void SgfFontLst::AssignFN(const OUString
& rFName
)
1101 void SgfFontLst::ReadList()
1110 aCfg
.SetGroup("SGV Fonts fuer StarView");
1111 sal_uInt16 Anz
=aCfg
.GetKeyCount();
1118 FID
= comphelper::string::remove(aCfg
.GetKeyName(i
), ' ');
1119 Dsc
= aCfg
.ReadKey( i
);
1120 if (comphelper::string::isdigitAsciiString(FID
))
1122 P
=new SgfFontOne
; // new entry
1123 if (Last
!=NULL
) Last
->Next
=P
; else pList
=P
; Last
=P
; // link it
1124 P
->ReadOne(FID
,Dsc
); // interpret line
1130 SgfFontOne
* SgfFontLst::GetFontDesc(sal_uInt32 ID
)
1135 while (P
!=NULL
&& P
->IFID
!=ID
) P
=P
->Next
;
1142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */