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 .
22 #include <tools/solar.h>
23 #include <sal/types.h> // for sal_Unicode
26 // For SwTxtHints without end index the following char is added:
28 #define CH_TXTATR_BREAKWORD ((sal_Unicode)0x01)
29 #define CH_TXTATR_INWORD ((sal_Unicode)0xFFF9)
30 #define CH_TXTATR_TAB ((sal_Unicode)'\t')
31 #define CH_TXTATR_NEWLINE ((sal_Unicode)'\n')
32 #define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x04)
33 #define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05)
34 #define CH_TXT_ATR_SUBST_FIELDSTART ("[")
35 #define CH_TXT_ATR_SUBST_FIELDEND ("]")
36 #define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
44 #define POOLATTR_BEGIN HINT_BEGIN
45 #define POOLATTR_END RES_UNKNOWNATR_END
47 // Ranges for the IDs of the format-attributes.
48 // Which-values for character-format attributes.
51 RES_CHRATR_BEGIN
= HINT_BEGIN
,
52 RES_CHRATR_CASEMAP
= RES_CHRATR_BEGIN
, // 1
53 RES_CHRATR_CHARSETCOLOR
, // 2
54 RES_CHRATR_COLOR
, // 3
55 RES_CHRATR_CONTOUR
, // 4
56 RES_CHRATR_CROSSEDOUT
, // 5
57 RES_CHRATR_ESCAPEMENT
, // 6
59 RES_CHRATR_FONTSIZE
, // 8
60 RES_CHRATR_KERNING
, // 9
61 RES_CHRATR_LANGUAGE
, // 10
62 RES_CHRATR_POSTURE
, // 11
63 RES_CHRATR_PROPORTIONALFONTSIZE
, // 12
64 RES_CHRATR_SHADOWED
, // 13
65 RES_CHRATR_UNDERLINE
, // 14
66 RES_CHRATR_WEIGHT
, // 15
67 RES_CHRATR_WORDLINEMODE
, // 16
68 RES_CHRATR_AUTOKERN
, // 17
69 RES_CHRATR_BLINK
, // 18
70 RES_CHRATR_NOHYPHEN
, // 19
71 RES_CHRATR_NOLINEBREAK
, // 20
72 RES_CHRATR_BACKGROUND
, // 21
73 RES_CHRATR_CJK_FONT
, // 22
74 RES_CHRATR_CJK_FONTSIZE
, // 23
75 RES_CHRATR_CJK_LANGUAGE
, // 24
76 RES_CHRATR_CJK_POSTURE
, // 25
77 RES_CHRATR_CJK_WEIGHT
, // 26
78 RES_CHRATR_CTL_FONT
, // 27
79 RES_CHRATR_CTL_FONTSIZE
, // 28
80 RES_CHRATR_CTL_LANGUAGE
, // 29
81 RES_CHRATR_CTL_POSTURE
, // 30
82 RES_CHRATR_CTL_WEIGHT
, // 31
83 RES_CHRATR_ROTATE
, // 32
84 RES_CHRATR_EMPHASIS_MARK
, // 33
85 RES_CHRATR_TWO_LINES
, // 34
86 RES_CHRATR_SCALEW
, // 35
87 RES_CHRATR_RELIEF
, // 36
88 RES_CHRATR_HIDDEN
, // 37
89 RES_CHRATR_OVERLINE
, // 38
90 RES_CHRATR_RSID
, // 39
91 RES_CHRATR_DUMMY1
, // 40
95 // this Attribute used only in a TextNodes SwpAttr-Array
98 RES_TXTATR_BEGIN
= RES_CHRATR_END
,
100 /** text attributes with start and end.
102 Hints (SwTxtAttr) with the same start and end position are sorted by
103 WhichId, i.e., the TXTATR constants defined here.
104 The text formatting (SwAttrIter) poses some requirements on TXTATR order:
105 - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style.
106 - INETFMT must precede CHARFMT, so that link style can overwrite char style.
107 (this is actually surprising: CHARFMT hints are not split at INETFMT
108 hints on insertion, but on exporting to ODF. if CHARFMT would precede
109 INETFMT, then exporting and importing will effectively change precedence)
111 Nesting hints (SwTxtAttrNesting) also have requirements on TXTATR order,
112 to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR):
113 - INETFMT should precede CJK_RUBY (for UNO API it does not matter...)
114 - META and METAFIELD must precede CJK_RUBY and INETFMT
116 RES_TXTATR_WITHEND_BEGIN
= RES_TXTATR_BEGIN
,
117 RES_TXTATR_REFMARK
= RES_TXTATR_WITHEND_BEGIN
, // 41
118 RES_TXTATR_TOXMARK
, // 42
119 RES_TXTATR_META
, // 43
120 RES_TXTATR_METAFIELD
, // 44
121 RES_TXTATR_AUTOFMT
, // 45
122 RES_TXTATR_INETFMT
, // 46
123 RES_TXTATR_CHARFMT
, // 47
124 RES_TXTATR_CJK_RUBY
, // 48
125 RES_TXTATR_UNKNOWN_CONTAINER
, // 49
126 RES_TXTATR_DUMMY5
, // 50
127 RES_TXTATR_WITHEND_END
,
129 // all TextAttributes without an end
130 RES_TXTATR_NOEND_BEGIN
= RES_TXTATR_WITHEND_END
,
131 RES_TXTATR_FIELD
= RES_TXTATR_NOEND_BEGIN
, // 51
132 RES_TXTATR_FLYCNT
, // 52
133 RES_TXTATR_FTN
, // 53
134 RES_TXTATR_DUMMY4
, // 54
135 RES_TXTATR_DUMMY3
, // 55
136 RES_TXTATR_DUMMY1
, // 56
137 RES_TXTATR_DUMMY2
, // 57
138 RES_TXTATR_NOEND_END
,
139 RES_TXTATR_END
= RES_TXTATR_NOEND_END
144 RES_PARATR_BEGIN
= RES_TXTATR_END
,
145 RES_PARATR_LINESPACING
= RES_PARATR_BEGIN
, // 58
146 RES_PARATR_ADJUST
, // 59
147 RES_PARATR_SPLIT
, // 60
148 RES_PARATR_ORPHANS
, // 61
149 RES_PARATR_WIDOWS
, // 62
150 RES_PARATR_TABSTOP
, // 63
151 RES_PARATR_HYPHENZONE
, // 64
152 RES_PARATR_DROP
, // 65
153 RES_PARATR_REGISTER
, // 66
154 RES_PARATR_NUMRULE
, // 67
155 RES_PARATR_SCRIPTSPACE
, // 68
156 RES_PARATR_HANGINGPUNCTUATION
, // 69
157 RES_PARATR_FORBIDDEN_RULES
, // 70
158 RES_PARATR_VERTALIGN
, // 71
159 RES_PARATR_SNAPTOGRID
, // 72
160 RES_PARATR_CONNECT_BORDER
, // 73
161 RES_PARATR_OUTLINELEVEL
, // 74
162 RES_PARATR_RSID
, // 75
166 // list attributes for paragraphs.
167 // intentionally these list attributes are not contained in paragraph styles
170 RES_PARATR_LIST_BEGIN
= RES_PARATR_END
,
171 RES_PARATR_LIST_ID
= RES_PARATR_LIST_BEGIN
, // 76
172 RES_PARATR_LIST_LEVEL
, // 77
173 RES_PARATR_LIST_ISRESTART
, // 78
174 RES_PARATR_LIST_RESTARTVALUE
, // 79
175 RES_PARATR_LIST_ISCOUNTED
, // 80
181 RES_FRMATR_BEGIN
= RES_PARATR_LIST_END
,
182 RES_FILL_ORDER
= RES_FRMATR_BEGIN
, // 81
196 RES_VERT_ORIENT
, // 95
197 RES_HORI_ORIENT
, // 96
199 RES_BACKGROUND
, // 98
206 RES_EDIT_IN_READONLY
, // 105
207 RES_LAYOUT_SPLIT
, // 106
210 RES_LINENUMBER
, // 109
211 RES_FTN_AT_TXTEND
, // 110
212 RES_END_AT_TXTEND
, // 111
213 RES_COLUMNBALANCE
, // 112
215 RES_HEADER_FOOTER_EAT_SPACING
, // 114
216 RES_ROW_SPLIT
, // 115
217 RES_FOLLOW_TEXT_FLOW
, // 116
218 RES_COLLAPSING_BORDERS
, // 117
219 RES_WRAP_INFLUENCE_ON_OBJPOS
, // 118
220 RES_AUTO_STYLE
, // 119
221 RES_FRMATR_STYLE_NAME
, // 120
222 RES_FRMATR_CONDITIONAL_STYLE_NAME
, // 121
223 RES_FILL_STYLE
, // 122
224 RES_FILL_GRADIENT
, // 123
230 RES_GRFATR_BEGIN
= RES_FRMATR_END
,
231 RES_GRFATR_MIRRORGRF
= RES_GRFATR_BEGIN
, // 124
232 RES_GRFATR_CROPGRF
, // 125
234 RES_GRFATR_ROTATION
, // 126
235 RES_GRFATR_LUMINANCE
, // 127
236 RES_GRFATR_CONTRAST
, // 128
237 RES_GRFATR_CHANNELR
, // 129
238 RES_GRFATR_CHANNELG
, // 130
239 RES_GRFATR_CHANNELB
, // 131
240 RES_GRFATR_GAMMA
, // 132
241 RES_GRFATR_INVERT
, // 133
242 RES_GRFATR_TRANSPARENCY
, // 134
243 RES_GRFATR_DRAWMODE
, // 135
245 RES_GRFATR_DUMMY1
, // 136
246 RES_GRFATR_DUMMY2
, // 137
247 RES_GRFATR_DUMMY3
, // 138
248 RES_GRFATR_DUMMY4
, // 139
249 RES_GRFATR_DUMMY5
, // 140
255 RES_BOXATR_BEGIN
= RES_GRFATR_END
,
256 RES_BOXATR_FORMAT
= RES_BOXATR_BEGIN
, // 141
257 RES_BOXATR_FORMULA
, // 142
258 RES_BOXATR_VALUE
, // 143
264 RES_UNKNOWNATR_BEGIN
= RES_BOXATR_END
,
265 RES_UNKNOWNATR_CONTAINER
= RES_UNKNOWNATR_BEGIN
,// 142
274 RES_FMT_BEGIN
= RES_UNKNOWNATR_END
,
275 RES_CHRFMT
= RES_FMT_BEGIN
,
285 // ID's for Messages in the Formats
288 RES_MSG_BEGIN
= RES_FMT_END
,
289 RES_OBJECTDYING
= RES_MSG_BEGIN
,
300 RES_PAGEDESC_FTNINFO
,
301 RES_REFMARKFLD_UPDATE
,
310 RES_SECTION_NOT_HIDDEN
,
312 RES_GRAPHIC_PIECE_ARRIVED
,
313 RES_HIDDENPARA_PRINT
,
314 RES_CONDCOLL_CONDCHG
,
315 RES_VIRTPAGENUM_INFO
,
316 RES_GETLOWERNUMLEVEL
,
317 RES_RESET_FMTWRITTEN
,
318 RES_REMOVE_UNO_OBJECT
,
319 RES_GRF_REREAD_AND_INCACHE
,
320 RES_SECTION_RESETHIDDENFLAG
,
323 RES_FOOTNOTE_DELETED
,
330 RES_DESCRIPTION_CHANGED
,
331 RES_UNOCURSOR_LEAVES_SECTION
,
332 RES_LINKED_GRAPHIC_STREAM_ARRIVED
,
336 // An ID for the RTF-reader. The stylesheets are treated like attributes,
337 // i.e. there is a StyleSheet-attribute. To avoid collision with other
338 // Which()-values, the value is listed here. (The help system too defines
342 RES_FLTRATTR_BEGIN
= RES_MSG_END
,
343 RES_FLTR_STYLESHEET
= RES_FLTRATTR_BEGIN
,
348 RES_FLTR_NUMRULE_NUM
,
357 #define RES_TBX_DUMMY RES_FLTRATTR_END + 1
359 #define HINT_END RES_TBX_DUMMY
361 // Error recognition!!
362 #define INVALID_HINT HINT_END
363 #define RES_WHICHHINT_END HINT_END
366 inline bool isATR(const sal_uInt16 nWhich
)
368 return (RES_CHRATR_BEGIN
<= nWhich
) && (RES_UNKNOWNATR_END
> nWhich
);
370 inline bool isCHRATR(const sal_uInt16 nWhich
)
372 return (RES_CHRATR_BEGIN
<= nWhich
) && (RES_CHRATR_END
> nWhich
);
374 inline bool isTXTATR_WITHEND(const sal_uInt16 nWhich
)
376 return (RES_TXTATR_WITHEND_BEGIN
<= nWhich
)
377 && (RES_TXTATR_WITHEND_END
> nWhich
);
379 inline bool isTXTATR_NOEND(const sal_uInt16 nWhich
)
381 return (RES_TXTATR_NOEND_BEGIN
<= nWhich
)
382 && (RES_TXTATR_NOEND_END
> nWhich
);
384 inline bool isTXTATR(const sal_uInt16 nWhich
)
386 return (RES_TXTATR_BEGIN
<= nWhich
) && (RES_TXTATR_END
> nWhich
);
388 inline bool isPARATR(const sal_uInt16 nWhich
)
390 return (RES_PARATR_BEGIN
<= nWhich
) && (RES_PARATR_END
> nWhich
);
392 inline bool isPARATR_LIST(const sal_uInt16 nWhich
)
394 return (RES_PARATR_LIST_BEGIN
<= nWhich
) && (RES_PARATR_LIST_END
> nWhich
); }
395 inline bool isFRMATR(const sal_uInt16 nWhich
)
397 return (RES_FRMATR_BEGIN
<= nWhich
) && (RES_FRMATR_END
> nWhich
);
399 inline bool isGRFATR(const sal_uInt16 nWhich
)
401 return (RES_GRFATR_BEGIN
<= nWhich
) && (RES_GRFATR_END
> nWhich
);
403 inline bool isBOXATR(const sal_uInt16 nWhich
)
405 return (RES_BOXATR_BEGIN
<= nWhich
) && (RES_BOXATR_END
> nWhich
);
407 inline bool isUNKNOWNATR(const sal_uInt16 nWhich
)
409 return (RES_UNKNOWNATR_BEGIN
<= nWhich
) && (RES_UNKNOWNATR_END
> nWhich
);
413 // Take the respective default attribute from the statistical default
414 // attributes table over the Which-value.
415 // If none exists, return a 0 pointer!!!
416 // This function is implemented in Init.cxx. It is declared here as external
417 // in order to allow the formats to access it.
418 // Inline in PRODUCT.
421 typedef SfxPoolItem
* SwDfltAttrTab
[ POOLATTR_END
- POOLATTR_BEGIN
];
423 extern SwDfltAttrTab aAttrTab
;
424 extern SfxItemInfo aSlotTab
[];
426 SW_DLLPUBLIC
const SfxPoolItem
* GetDfltAttr( sal_uInt16 nWhich
);
428 SW_DLLPUBLIC sal_uInt16
GetWhichOfScript( sal_uInt16 nWhich
, sal_uInt16 nScript
);
430 // return for the given TextAttribute without an end the correct character.
431 // This function returns
432 // CH_TXTATR_BREAKWORD for Textattribute which breaks a word (default)
433 // CH_TXTATR_INWORD for Textattribute which dont breaks a word
435 sal_Unicode
GetCharOfTxtAttr( const SwTxtAttr
& rAttr
);
437 // all Sets defined in init.cxx
439 // AttrSet-Range for the 3 Break-Attribute
440 extern sal_uInt16 aBreakSetRange
[];
441 // AttrSet-Range for TxtFmtColl
442 extern sal_uInt16 aTxtFmtCollSetRange
[];
443 // AttrSet-Range for GrfFmtColl
444 extern sal_uInt16 aGrfFmtCollSetRange
[];
445 // AttrSet-Range for TextNode
446 SW_DLLPUBLIC
extern sal_uInt16 aTxtNodeSetRange
[];
447 // AttrSet-Range for NoTxtNode
448 extern sal_uInt16 aNoTxtNodeSetRange
[];
449 // AttrSet-Range for SwTable
450 extern sal_uInt16 aTableSetRange
[];
451 // AttrSet-Range for SwTableLine
452 extern sal_uInt16 aTableLineSetRange
[];
453 // AttrSet-Range for SwTableBox
454 extern sal_uInt16 aTableBoxSetRange
[];
455 // AttrSet-Range for SwFrmFmt
456 SW_DLLPUBLIC
extern sal_uInt16 aFrmFmtSetRange
[];
457 // AttrSet-Range for SwCharFmt
458 extern sal_uInt16 aCharFmtSetRange
[];
459 // AttrSet-Range for the autostyles
460 extern sal_uInt16 aCharAutoFmtSetRange
[];
461 // AttrSet-Range for SwPageDescFmt
462 extern sal_uInt16 aPgFrmFmtSetRange
[];
464 // check if ID is InRange of AttrSet-Ids
465 bool IsInRange( const sal_uInt16
* pRange
, const sal_uInt16 nId
);
469 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */