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 .
19 #ifndef INCLUDED_SW_INC_HINTIDS_HXX
20 #define INCLUDED_SW_INC_HINTIDS_HXX
22 #include <tools/solar.h>
23 #include <sal/types.h>
24 #include <svx/xdef.hxx>
28 // For SwTextHints without end index the following char is added:
30 #define CH_TXTATR_BREAKWORD u'\x0001'
31 #define CH_TXTATR_INWORD u'\xFFF9'
32 #define CH_TXTATR_TAB u'\t'
33 #define CH_TXTATR_NEWLINE u'\n'
34 #define CH_TXT_ATR_INPUTFIELDSTART u'\x0004'
35 #define CH_TXT_ATR_INPUTFIELDEND u'\x0005'
37 #define CH_TXT_ATR_FORMELEMENT u'\x0006'
39 #define CH_TXT_ATR_FIELDSTART u'\x0007'
40 #define CH_TXT_ATR_FIELDEND u'\x0008'
41 #define CH_TXT_ATR_SUBST_FIELDSTART ("[")
42 #define CH_TXT_ATR_SUBST_FIELDEND ("]")
50 #define POOLATTR_BEGIN HINT_BEGIN
51 #define POOLATTR_END RES_UNKNOWNATR_END
53 // Ranges for the IDs of the format-attributes.
54 // Which-values for character-format attributes.
57 RES_CHRATR_BEGIN
= HINT_BEGIN
,
58 RES_CHRATR_CASEMAP
= RES_CHRATR_BEGIN
, // 1
59 RES_CHRATR_CHARSETCOLOR
, // 2
60 RES_CHRATR_COLOR
, // 3
61 RES_CHRATR_CONTOUR
, // 4
62 RES_CHRATR_CROSSEDOUT
, // 5
63 RES_CHRATR_ESCAPEMENT
, // 6
65 RES_CHRATR_FONTSIZE
, // 8
66 RES_CHRATR_KERNING
, // 9
67 RES_CHRATR_LANGUAGE
, // 10
68 RES_CHRATR_POSTURE
, // 11
69 RES_CHRATR_PROPORTIONALFONTSIZE
, // 12
70 RES_CHRATR_SHADOWED
, // 13
71 RES_CHRATR_UNDERLINE
, // 14
72 RES_CHRATR_WEIGHT
, // 15
73 RES_CHRATR_WORDLINEMODE
, // 16
74 RES_CHRATR_AUTOKERN
, // 17
75 RES_CHRATR_BLINK
, // 18
76 RES_CHRATR_NOHYPHEN
, // 19
77 RES_CHRATR_NOLINEBREAK
, // 20
78 RES_CHRATR_BACKGROUND
, // 21
79 RES_CHRATR_CJK_FONT
, // 22
80 RES_CHRATR_CJK_FONTSIZE
, // 23
81 RES_CHRATR_CJK_LANGUAGE
, // 24
82 RES_CHRATR_CJK_POSTURE
, // 25
83 RES_CHRATR_CJK_WEIGHT
, // 26
84 RES_CHRATR_CTL_FONT
, // 27
85 RES_CHRATR_CTL_FONTSIZE
, // 28
86 RES_CHRATR_CTL_LANGUAGE
, // 29
87 RES_CHRATR_CTL_POSTURE
, // 30
88 RES_CHRATR_CTL_WEIGHT
, // 31
89 RES_CHRATR_ROTATE
, // 32
90 RES_CHRATR_EMPHASIS_MARK
, // 33
91 RES_CHRATR_TWO_LINES
, // 34
92 RES_CHRATR_SCALEW
, // 35
93 RES_CHRATR_RELIEF
, // 36
94 RES_CHRATR_HIDDEN
, // 37
95 RES_CHRATR_OVERLINE
, // 38
96 RES_CHRATR_RSID
, // 39
98 RES_CHRATR_SHADOW
, // 41
99 RES_CHRATR_HIGHLIGHT
, // 42
100 RES_CHRATR_GRABBAG
, // 43
101 RES_CHRATR_BIDIRTL
, // 44
102 RES_CHRATR_IDCTHINT
, // 45
106 // this Attribute used only in a TextNodes SwpAttr-Array
109 RES_TXTATR_BEGIN
= RES_CHRATR_END
,
111 /** text attributes with start and end.
113 Hints (SwTextAttr) with the same start and end position are sorted by
114 WhichId, i.e., the TXTATR constants defined here.
115 The text formatting (SwAttrIter) poses some requirements on TXTATR order:
116 - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style.
117 - INETFMT must precede CHARFMT, so that link style can overwrite char style.
118 (this is actually surprising: CHARFMT hints are not split at INETFMT
119 hints on insertion, but on exporting to ODF. if CHARFMT would precede
120 INETFMT, then exporting and importing will effectively change precedence)
122 Nesting hints (SwTextAttrNesting) also have requirements on TXTATR order,
123 to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR):
124 - INETFMT should precede CJK_RUBY (for UNO API it does not matter...)
125 - META and METAFIELD must precede CJK_RUBY and INETFMT
127 RES_TXTATR_WITHEND_BEGIN
= RES_TXTATR_BEGIN
,
128 RES_TXTATR_REFMARK
= RES_TXTATR_WITHEND_BEGIN
, // 46
129 RES_TXTATR_TOXMARK
, // 47
130 RES_TXTATR_META
, // 48
131 RES_TXTATR_METAFIELD
, // 49
132 RES_TXTATR_AUTOFMT
, // 50
133 RES_TXTATR_INETFMT
, // 51
134 RES_TXTATR_CHARFMT
, // 52
135 RES_TXTATR_CJK_RUBY
, // 53
136 RES_TXTATR_UNKNOWN_CONTAINER
, // 54
137 RES_TXTATR_INPUTFIELD
, // 55
138 RES_TXTATR_WITHEND_END
,
140 // all TextAttributes without an end
141 RES_TXTATR_NOEND_BEGIN
= RES_TXTATR_WITHEND_END
,
142 RES_TXTATR_FIELD
= RES_TXTATR_NOEND_BEGIN
, // 56
143 RES_TXTATR_FLYCNT
, // 57
144 RES_TXTATR_FTN
, // 58
145 RES_TXTATR_ANNOTATION
, // 59
146 RES_TXTATR_DUMMY3
, // 60
147 RES_TXTATR_DUMMY1
, // 61
148 RES_TXTATR_DUMMY2
, // 62
149 RES_TXTATR_NOEND_END
,
150 RES_TXTATR_END
= RES_TXTATR_NOEND_END
155 RES_PARATR_BEGIN
= RES_TXTATR_END
,
156 RES_PARATR_LINESPACING
= RES_PARATR_BEGIN
, // 63
157 RES_PARATR_ADJUST
, // 64
158 RES_PARATR_SPLIT
, // 65
159 RES_PARATR_ORPHANS
, // 66
160 RES_PARATR_WIDOWS
, // 67
161 RES_PARATR_TABSTOP
, // 68
162 RES_PARATR_HYPHENZONE
, // 69
163 RES_PARATR_DROP
, // 70
164 RES_PARATR_REGISTER
, // 71
165 RES_PARATR_NUMRULE
, // 72
166 RES_PARATR_SCRIPTSPACE
, // 73
167 RES_PARATR_HANGINGPUNCTUATION
, // 74
168 RES_PARATR_FORBIDDEN_RULES
, // 75
169 RES_PARATR_VERTALIGN
, // 76
170 RES_PARATR_SNAPTOGRID
, // 77
171 RES_PARATR_CONNECT_BORDER
, // 78
172 RES_PARATR_OUTLINELEVEL
, // 79
173 RES_PARATR_RSID
, // 80
174 RES_PARATR_GRABBAG
, // 81
178 // list attributes for paragraphs.
179 // intentionally these list attributes are not contained in paragraph styles
182 RES_PARATR_LIST_BEGIN
= RES_PARATR_END
,
183 RES_PARATR_LIST_ID
= RES_PARATR_LIST_BEGIN
, // 82
184 RES_PARATR_LIST_LEVEL
, // 83
185 RES_PARATR_LIST_ISRESTART
, // 84
186 RES_PARATR_LIST_RESTARTVALUE
, // 85
187 RES_PARATR_LIST_ISCOUNTED
, // 86
193 RES_FRMATR_BEGIN
= RES_PARATR_LIST_END
,
194 RES_FILL_ORDER
= RES_FRMATR_BEGIN
, // 87
208 RES_VERT_ORIENT
, // 101
209 RES_HORI_ORIENT
, // 102
211 RES_BACKGROUND
, // 104
218 RES_EDIT_IN_READONLY
, // 111
219 RES_LAYOUT_SPLIT
, // 112
222 RES_LINENUMBER
, // 115
223 RES_FTN_AT_TXTEND
, // 116
224 RES_END_AT_TXTEND
, // 117
225 RES_COLUMNBALANCE
, // 118
227 RES_HEADER_FOOTER_EAT_SPACING
, // 120
228 RES_ROW_SPLIT
, // 121
229 RES_FOLLOW_TEXT_FLOW
, // 122
230 RES_COLLAPSING_BORDERS
, // 123
231 RES_WRAP_INFLUENCE_ON_OBJPOS
, // 124
232 RES_AUTO_STYLE
, // 125
233 RES_FRMATR_STYLE_NAME
, // 126
234 RES_FRMATR_CONDITIONAL_STYLE_NAME
, // 127
235 RES_FRMATR_GRABBAG
, // 128
236 RES_TEXT_VERT_ADJUST
, // 129
242 RES_GRFATR_BEGIN
= RES_FRMATR_END
,
243 RES_GRFATR_MIRRORGRF
= RES_GRFATR_BEGIN
, // 130
244 RES_GRFATR_CROPGRF
, // 131
246 RES_GRFATR_ROTATION
, // 132
247 RES_GRFATR_LUMINANCE
, // 133
248 RES_GRFATR_CONTRAST
, // 134
249 RES_GRFATR_CHANNELR
, // 135
250 RES_GRFATR_CHANNELG
, // 136
251 RES_GRFATR_CHANNELB
, // 137
252 RES_GRFATR_GAMMA
, // 138
253 RES_GRFATR_INVERT
, // 139
254 RES_GRFATR_TRANSPARENCY
, // 140
255 RES_GRFATR_DRAWMODE
, // 141
257 RES_GRFATR_DUMMY1
, // 142
258 RES_GRFATR_DUMMY2
, // 143
259 RES_GRFATR_DUMMY3
, // 144
260 RES_GRFATR_DUMMY4
, // 145
261 RES_GRFATR_DUMMY5
, // 146
267 RES_BOXATR_BEGIN
= RES_GRFATR_END
,
268 RES_BOXATR_FORMAT
= RES_BOXATR_BEGIN
, // 147
269 RES_BOXATR_FORMULA
, // 148
270 RES_BOXATR_VALUE
, // 149
276 RES_UNKNOWNATR_BEGIN
= RES_BOXATR_END
,
277 RES_UNKNOWNATR_CONTAINER
= RES_UNKNOWNATR_BEGIN
,// 150
284 RES_FMT_BEGIN
= RES_UNKNOWNATR_END
,
285 RES_CHRFMT
= RES_FMT_BEGIN
, // 151
287 RES_FLYFRMFMT
, // 153
288 RES_TXTFMTCOLL
, // 154
289 RES_GRFFMTCOLL
, // 155
290 RES_DRAWFRMFMT
, // 156
291 RES_CONDTXTFMTCOLL
, // 157
295 // ID's for Messages in the Formats
298 RES_MSG_BEGIN
= RES_FMT_END
,
299 RES_OBJECTDYING
= RES_MSG_BEGIN
, // 158
306 RES_REFMARKFLD_UPDATE
,
313 RES_SECTION_NOT_HIDDEN
,
315 RES_GRAPHIC_PIECE_ARRIVED
,
316 RES_HIDDENPARA_PRINT
,
317 RES_CONDCOLL_CONDCHG
,
318 RES_VIRTPAGENUM_INFO
,
319 RES_RESET_FMTWRITTEN
,
320 RES_REMOVE_UNO_OBJECT
,
321 RES_GRF_REREAD_AND_INCACHE
,
322 RES_SECTION_RESETHIDDENFLAG
,
328 RES_DESCRIPTION_CHANGED
,
329 RES_LINKED_GRAPHIC_STREAM_ARRIVED
,
333 // An ID for the RTF-reader. The stylesheets are treated like attributes,
334 // i.e. there is a StyleSheet-attribute. To avoid collision with other
335 // Which()-values, the value is listed here. (The help system too defines
339 RES_FLTRATTR_BEGIN
= RES_MSG_END
,
340 RES_FLTR_BOOKMARK
= RES_FLTRATTR_BEGIN
,
345 RES_FLTR_ANNOTATIONMARK
,
350 #define RES_TBX_DUMMY RES_FLTRATTR_END + 1
352 #define HINT_END RES_TBX_DUMMY
354 // Error recognition!!
355 #define INVALID_HINT HINT_END
356 #define RES_WHICHHINT_END HINT_END
358 inline bool isATR(const sal_uInt16 nWhich
)
360 return (RES_CHRATR_BEGIN
<= nWhich
) && (RES_UNKNOWNATR_END
> nWhich
);
362 inline bool isCHRATR(const sal_uInt16 nWhich
)
364 return (RES_CHRATR_BEGIN
<= nWhich
) && (RES_CHRATR_END
> nWhich
);
366 inline bool isTXTATR_WITHEND(const sal_uInt16 nWhich
)
368 return (RES_TXTATR_WITHEND_BEGIN
<= nWhich
)
369 && (RES_TXTATR_WITHEND_END
> nWhich
);
371 inline bool isTXTATR_NOEND(const sal_uInt16 nWhich
)
373 return (RES_TXTATR_NOEND_BEGIN
<= nWhich
)
374 && (RES_TXTATR_NOEND_END
> nWhich
);
376 inline bool isTXTATR(const sal_uInt16 nWhich
)
378 return (RES_TXTATR_BEGIN
<= nWhich
) && (RES_TXTATR_END
> nWhich
);
380 inline bool isPARATR(const sal_uInt16 nWhich
)
382 return (RES_PARATR_BEGIN
<= nWhich
) && (RES_PARATR_END
> nWhich
);
384 inline bool isPARATR_LIST(const sal_uInt16 nWhich
)
386 return (RES_PARATR_LIST_BEGIN
<= nWhich
) && (RES_PARATR_LIST_END
> nWhich
);
388 inline bool isFRMATR(const sal_uInt16 nWhich
)
390 return (RES_FRMATR_BEGIN
<= nWhich
) && (RES_FRMATR_END
> nWhich
);
392 inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich
)
394 return (XATTR_START
<= nWhich
) && (XATTR_END
> nWhich
);
396 inline bool isGRFATR(const sal_uInt16 nWhich
)
398 return (RES_GRFATR_BEGIN
<= nWhich
) && (RES_GRFATR_END
> nWhich
);
400 inline bool isBOXATR(const sal_uInt16 nWhich
)
402 return (RES_BOXATR_BEGIN
<= nWhich
) && (RES_BOXATR_END
> nWhich
);
404 inline bool isUNKNOWNATR(const sal_uInt16 nWhich
)
406 return (RES_UNKNOWNATR_BEGIN
<= nWhich
) && (RES_UNKNOWNATR_END
> nWhich
);
409 // Take the respective default attribute from the statistical default
410 // attributes table over the Which-value.
411 // If none exists, return a 0 pointer!!!
412 // This function is implemented in Init.cxx. It is declared here as external
413 // in order to allow the formats to access it.
414 // Inline in PRODUCT.
417 typedef std::vector
<SfxPoolItem
*> SwDfltAttrTab
;
419 extern SwDfltAttrTab aAttrTab
;
420 extern SfxItemInfo aSlotTab
[];
422 /** Get the default attribute from corresponding default attribute table.
424 @param[in] nWhich Position in table
425 @return Attribute if found, null pointer otherwise
427 SW_DLLPUBLIC
const SfxPoolItem
* GetDfltAttr( sal_uInt16 nWhich
);
429 SW_DLLPUBLIC sal_uInt16
GetWhichOfScript( sal_uInt16 nWhich
, sal_uInt16 nScript
);
431 // return for the given TextAttribute without an end the correct character.
432 // This function returns
433 // CH_TXTATR_BREAKWORD for Textattribute which breaks a word (default)
434 // CH_TXTATR_INWORD for Textattribute which doesn't breaks a word
436 sal_Unicode
GetCharOfTextAttr( const SwTextAttr
& rAttr
);
438 // all Sets defined in init.cxx
440 // AttrSet-Range for the 3 Break-Attribute
441 extern sal_uInt16 aBreakSetRange
[];
442 // AttrSet-Range for TextFormatColl
443 extern sal_uInt16 aTextFormatCollSetRange
[];
444 // AttrSet-Range for GrfFormatColl
445 extern sal_uInt16 aGrfFormatCollSetRange
[];
446 // AttrSet-Range for TextNode
447 SW_DLLPUBLIC
extern sal_uInt16 aTextNodeSetRange
[];
448 // AttrSet-Range for NoTextNode
449 extern sal_uInt16 aNoTextNodeSetRange
[];
450 // AttrSet-Range for SwTable
451 extern sal_uInt16 aTableSetRange
[];
452 // AttrSet-Range for SwTableLine
453 extern sal_uInt16 aTableLineSetRange
[];
454 // AttrSet-Range for SwTableBox
455 extern sal_uInt16 aTableBoxSetRange
[];
456 // AttrSet-Range for SwFrameFormat
457 SW_DLLPUBLIC
extern sal_uInt16 aFrameFormatSetRange
[];
458 // AttrSet-Range for SwCharFormat
459 extern sal_uInt16 aCharFormatSetRange
[];
460 // AttrSet-Range for the autostyles
461 extern sal_uInt16 aCharAutoFormatSetRange
[];
462 // AttrSet-Range for SwPageDescFormat
463 extern sal_uInt16 aPgFrameFormatSetRange
[];
465 // check if ID is InRange of AttrSet-Ids
466 bool IsInRange( const sal_uInt16
* pRange
, const sal_uInt16 nId
);
470 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */