xref: /aoo42x/main/sw/inc/hintids.hxx (revision c0286415)
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 #ifndef _HINTIDS_HXX
24 #define _HINTIDS_HXX
25 
26 #include <tools/solar.h>		// fuer __FAR_DATA
27 #include <sal/types.h>			// for sal_Unicode
28 #include "swdllapi.h"
29 
30 // fuer SwTxtHints ohne Endindex wird folgendes Zeichen eingefuegt:
31 //JP 24.05.00: for the new UniCode Version:
32 #define CH_TXTATR_BREAKWORD		((sal_Unicode)0x01)
33 #define CH_TXTATR_INWORD		((sal_Unicode)0x02)
34 #define CH_TXTATR_TAB           ((sal_Unicode)'\t')
35 #define CH_TXTATR_NEWLINE       ((sal_Unicode)'\n')
36 #define CH_TXT_ATR_FIELDSTART ((sal_Unicode)0x04)
37 #define CH_TXT_ATR_FIELDEND ((sal_Unicode)0x05)
38 #define CH_TXT_ATR_SUBST_FIELDSTART ("[")
39 #define CH_TXT_ATR_SUBST_FIELDEND ("]")
40 #define CH_TXT_ATR_FORMELEMENT ((sal_Unicode)0x06)
41 
42 /*
43  * Hier kommen erst mal die enums fuer die Hints
44  */
45 
46 #define HINT_BEGIN	1
47 
48 #define POOLATTR_BEGIN		HINT_BEGIN
49 #define POOLATTR_END		RES_UNKNOWNATR_END
50 
51 // Bereiche fuer die Id's der einzelnen Format-Attribute
52 // die Which-Werte fuer die Charakter-Format Attribute
53 enum RES_CHRATR
54 {
55 RES_CHRATR_BEGIN = HINT_BEGIN,
56 	RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN,	//	1
57 	RES_CHRATR_CHARSETCOLOR,				//	2
58 	RES_CHRATR_COLOR,						//	3
59 	RES_CHRATR_CONTOUR,						//	4
60 	RES_CHRATR_CROSSEDOUT,					//	5
61 	RES_CHRATR_ESCAPEMENT,					//	6
62 	RES_CHRATR_FONT,						//	7
63 	RES_CHRATR_FONTSIZE,					//	8
64 	RES_CHRATR_KERNING, 					//	9
65 	RES_CHRATR_LANGUAGE,					// 10
66 	RES_CHRATR_POSTURE, 					// 11
67 	RES_CHRATR_PROPORTIONALFONTSIZE,		// 12
68 	RES_CHRATR_SHADOWED,					// 13
69 	RES_CHRATR_UNDERLINE,					// 14
70 	RES_CHRATR_WEIGHT,						// 15
71 	RES_CHRATR_WORDLINEMODE,				// 16
72 	RES_CHRATR_AUTOKERN,					// 17
73 	RES_CHRATR_BLINK,						// 18
74 	RES_CHRATR_NOHYPHEN,					// 19
75 	RES_CHRATR_NOLINEBREAK, 				// 20
76 	RES_CHRATR_BACKGROUND,					// 21
77 	RES_CHRATR_CJK_FONT,					// 22
78 	RES_CHRATR_CJK_FONTSIZE,				// 23
79 	RES_CHRATR_CJK_LANGUAGE,				// 24
80 	RES_CHRATR_CJK_POSTURE, 				// 25
81 	RES_CHRATR_CJK_WEIGHT,					// 26
82 	RES_CHRATR_CTL_FONT,					// 27
83 	RES_CHRATR_CTL_FONTSIZE,				// 28
84 	RES_CHRATR_CTL_LANGUAGE,				// 29
85 	RES_CHRATR_CTL_POSTURE, 				// 30
86 	RES_CHRATR_CTL_WEIGHT,					// 31
87 	RES_CHRATR_ROTATE,						// 32
88 	RES_CHRATR_EMPHASIS_MARK,				// 33
89 	RES_CHRATR_TWO_LINES, 					// 34
90 	RES_CHRATR_SCALEW,						// 35
91 	RES_CHRATR_RELIEF,						// 36
92     RES_CHRATR_HIDDEN,                      // 37
93 	RES_CHRATR_OVERLINE,					// 38
94 	RES_CHRATR_DUMMY1,						// 39
95 	RES_CHRATR_DUMMY2,						// 40
96 	RES_CHRATR_BIDIRTL,						// 41
97 	RES_CHRATR_IDCTHINT,					// 42
98 RES_CHRATR_END
99 };
100 
101 // diese Attribute stehen nur im SwpAttr-Array vom TextNode
102 enum RES_TXTATR
103 {
104 RES_TXTATR_BEGIN = RES_CHRATR_END,
105 
106 /** text attributes with start and end.
107    #i105453#:
108    Hints (SwTxtAttr) with the same start and end position are sorted by
109    WhichId, i.e., the TXTATR constants defined here.
110    The text formatting (SwAttrIter) poses some requirements on TXTATR order:
111    - AUTOFMT must precede CHARFMT, so that auto style can overwrite char style.
112    - INETFMT must precede CHARFMT, so that link style can overwrite char style.
113      (this is actually surprising: CHARFMT hints are not split at INETFMT
114       hints on insertion, but on exporting to ODF. if CHARFMT would precede
115       INETFMT, then exporting and importing will effectively change precedence)
116 
117    Nesting hints (SwTxtAttrNesting) also have requirements on TXTATR order,
118    to ensure proper nesting (because CJK_RUBY and INETFMT have no CH_TXTATR):
119    - INETFMT should precede CJK_RUBY (for UNO API it does not matter...)
120    - META and METAFIELD must precede CJK_RUBY and INETFMT
121  */
122 RES_TXTATR_WITHEND_BEGIN = RES_TXTATR_BEGIN ,
123     RES_TXTATR_REFMARK = RES_TXTATR_WITHEND_BEGIN,  // 43
124     RES_TXTATR_TOXMARK,                             // 44
125     RES_TXTATR_META,                                // 45
126     RES_TXTATR_METAFIELD,                           // 46
127     RES_TXTATR_AUTOFMT,                             // 47
128     RES_TXTATR_INETFMT,                             // 48
129     RES_TXTATR_CHARFMT,                             // 49
130     RES_TXTATR_CJK_RUBY,                            // 50
131     RES_TXTATR_UNKNOWN_CONTAINER,                   // 51
132     RES_TXTATR_DUMMY5,                              // 52
133 RES_TXTATR_WITHEND_END,
134 
135 // alle TextAttribute ohne ein Ende
136 RES_TXTATR_NOEND_BEGIN = RES_TXTATR_WITHEND_END,
137     RES_TXTATR_FIELD = RES_TXTATR_NOEND_BEGIN,      // 53
138     RES_TXTATR_FLYCNT,                              // 54
139     RES_TXTATR_FTN,                                 // 55
140     RES_TXTATR_DUMMY4,                              // 56
141     RES_TXTATR_DUMMY3,                              // 57
142     RES_TXTATR_DUMMY1,                              // 58
143     RES_TXTATR_DUMMY2,                              // 59
144 RES_TXTATR_NOEND_END,
145 RES_TXTATR_END = RES_TXTATR_NOEND_END
146 };
147 
148 enum RES_PARATR
149 {
150 RES_PARATR_BEGIN = RES_TXTATR_END,
151     RES_PARATR_LINESPACING = RES_PARATR_BEGIN,      // 60
152 	RES_PARATR_ADJUST,								// 61
153 	RES_PARATR_SPLIT,								// 62
154 	RES_PARATR_ORPHANS, 							// 63
155 	RES_PARATR_WIDOWS,								// 64
156 	RES_PARATR_TABSTOP, 							// 65
157 	RES_PARATR_HYPHENZONE,							// 66
158 	RES_PARATR_DROP,								// 67
159 	RES_PARATR_REGISTER,							// 68
160 	RES_PARATR_NUMRULE, 							// 69
161 	RES_PARATR_SCRIPTSPACE,							// 70
162 	RES_PARATR_HANGINGPUNCTUATION,					// 71
163 	RES_PARATR_FORBIDDEN_RULES,						// 72
164 	RES_PARATR_VERTALIGN,							// 73
165     RES_PARATR_SNAPTOGRID,                          // 74
166     RES_PARATR_CONNECT_BORDER,                      // 75
167     RES_PARATR_OUTLINELEVEL,                        // 76
168 RES_PARATR_END
169 };
170 
171 // --> OD 2008-02-25 #refactorlists#
172 // list attributes for paragraphs.
173 // intentionally these list attributes are not contained in paragraph styles
174 enum RES_PARATR_LIST
175 {
176 RES_PARATR_LIST_BEGIN = RES_PARATR_END,
177     RES_PARATR_LIST_ID = RES_PARATR_LIST_BEGIN,     // 77
178     RES_PARATR_LIST_LEVEL,                          // 78
179     RES_PARATR_LIST_ISRESTART,                      // 79
180     RES_PARATR_LIST_RESTARTVALUE,                   // 80
181     RES_PARATR_LIST_ISCOUNTED,                      // 81
182 RES_PARATR_LIST_END
183 };
184 // <--
185 
186 enum RES_FRMATR
187 {
188 RES_FRMATR_BEGIN = RES_PARATR_LIST_END,
189     RES_FILL_ORDER = RES_FRMATR_BEGIN,              // 82
190     RES_FRM_SIZE,                                   // 83
191     RES_PAPER_BIN,                                  // 84
192     RES_LR_SPACE,                                   // 85
193     RES_UL_SPACE,                                   // 86
194     RES_PAGEDESC,                                   // 87
195     RES_BREAK,                                      // 88
196     RES_CNTNT,                                      // 89
197     RES_HEADER,                                     // 90
198     RES_FOOTER,                                     // 91
199     RES_PRINT,                                      // 92
200     RES_OPAQUE,                                     // 93
201     RES_PROTECT,                                    // 94
202     RES_SURROUND,                                   // 95
203     RES_VERT_ORIENT,                                // 96
204     RES_HORI_ORIENT,                                // 97
205     RES_ANCHOR,                                     // 98
206     RES_BACKGROUND,                                 // 99
207     RES_BOX,                                        // 100
208     RES_SHADOW,                                     // 101
209     RES_FRMMACRO,                                   // 102
210     RES_COL,                                        // 103
211     RES_KEEP,                                       // 104
212     RES_URL,                                        // 105
213     RES_EDIT_IN_READONLY,                           // 106
214     RES_LAYOUT_SPLIT,                               // 107
215     RES_CHAIN,                                      // 108
216     RES_TEXTGRID,                                   // 109
217     RES_LINENUMBER  ,                               // 110
218     RES_FTN_AT_TXTEND,                              // 111
219     RES_END_AT_TXTEND,                              // 112
220     RES_COLUMNBALANCE,                              // 113
221     RES_FRAMEDIR,                                   // 114
222     RES_HEADER_FOOTER_EAT_SPACING,                  // 115
223     RES_ROW_SPLIT,                                  // 116
224     RES_FOLLOW_TEXT_FLOW,                           // 117
225     RES_COLLAPSING_BORDERS,                         // 118
226     RES_WRAP_INFLUENCE_ON_OBJPOS,                   // 119
227     RES_AUTO_STYLE,                                 // 120
228     RES_FRMATR_STYLE_NAME,                          // 121
229     RES_FRMATR_CONDITIONAL_STYLE_NAME,              // 122
230 RES_FRMATR_END
231 };
232 
233 enum RES_GRFATR
234 {
235 RES_GRFATR_BEGIN = RES_FRMATR_END,
236     RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN,        // 123
237     RES_GRFATR_CROPGRF,                             // 124
238 
239     RES_GRFATR_ROTATION,                            // 125
240     RES_GRFATR_LUMINANCE,                           // 126
241     RES_GRFATR_CONTRAST,                            // 127
242     RES_GRFATR_CHANNELR,                            // 128
243     RES_GRFATR_CHANNELG,                            // 129
244     RES_GRFATR_CHANNELB,                            // 130
245     RES_GRFATR_GAMMA,                               // 131
246     RES_GRFATR_INVERT,                              // 132
247     RES_GRFATR_TRANSPARENCY,                        // 133
248     RES_GRFATR_DRAWMODE,                            // 134
249 
250     RES_GRFATR_DUMMY1,                              // 135
251     RES_GRFATR_DUMMY2,                              // 136
252     RES_GRFATR_DUMMY3,                              // 137
253     RES_GRFATR_DUMMY4,                              // 138
254     RES_GRFATR_DUMMY5,                              // 139
255 RES_GRFATR_END
256 };
257 
258 enum RES_BOXATR
259 {
260 RES_BOXATR_BEGIN = RES_GRFATR_END,
261     RES_BOXATR_FORMAT = RES_BOXATR_BEGIN,           // 140
262     RES_BOXATR_FORMULA,                             // 141
263     RES_BOXATR_VALUE,                               // 142
264 RES_BOXATR_END
265 };
266 
267 enum RES_UNKNOWNATR
268 {
269 RES_UNKNOWNATR_BEGIN = RES_BOXATR_END,
270     RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 143
271 RES_UNKNOWNATR_END
272 };
273 
274 
275 
276 // ID-s fuer die Formate
277 enum RES_FMT
278 {
279 RES_FMT_BEGIN = RES_UNKNOWNATR_END,
280 	RES_CHRFMT = RES_FMT_BEGIN,
281 	RES_FRMFMT,
282 	RES_FLYFRMFMT,
283 	RES_TXTFMTCOLL,
284 	RES_GRFFMTCOLL,
285 	RES_DRAWFRMFMT,
286 	RES_CONDTXTFMTCOLL,
287 RES_FMT_END
288 };
289 
290 // die ID's fuer Messages in den Formaten
291 enum RES_MSG
292 {
293 RES_MSG_BEGIN = RES_FMT_END,
294 	RES_OBJECTDYING = RES_MSG_BEGIN,
295 	RES_FMT_CHG,
296 	RES_ATTRSET_CHG,
297 	RES_FRM_SIZECHG,
298 	RES_TXTATR_FLDCHG,
299 	RES_TXTATR_EMPTYCHG,
300 	RES_INS_CHR,
301 	RES_INS_TXT,
302 	RES_DEL_CHR,
303 	RES_DEL_TXT,
304 	RES_UPDATE_ATTR,
305 	RES_PAGEDESC_FTNINFO,
306 	RES_REFMARKFLD_UPDATE,
307 	RES_DOCPOS_UPDATE,
308 	RES_TABLEFML_UPDATE,
309 	RES_UPDATEDDETBL,
310 	RES_TBLHEADLINECHG,
311 	RES_AUTOFMT_DOCNODE,
312 	RES_REPAINT,
313 	RES_DOC_DTOR,
314 	RES_SECTION_HIDDEN,
315 	RES_SECTION_NOT_HIDDEN,
316 	RES_GRAPHIC_ARRIVED,
317 	RES_GRAPHIC_PIECE_ARRIVED,
318 	RES_HIDDENPARA_PRINT,
319 	RES_CONDCOLL_CONDCHG,
320 	RES_VIRTPAGENUM_INFO,
321     // --> OD 2008-02-25 #refactorlists#
322 //    RES_GETNUMNODES,
323     // <--
324 	RES_GETLOWERNUMLEVEL,
325 	RES_RESET_FMTWRITTEN,
326 	RES_REMOVE_UNO_OBJECT,
327 	RES_GRF_REREAD_AND_INCACHE,
328 	RES_SECTION_RESETHIDDENFLAG,
329 	RES_FINDNEARESTNODE,
330 	RES_CONTENT_VISIBLE,
331 	RES_FOOTNOTE_DELETED,
332 	RES_REFMARK_DELETED,
333 	RES_TOXMARK_DELETED,
334 	RES_GRAPHIC_SWAPIN,
335 	RES_FIELD_DELETED,
336 	RES_NAME_CHANGED,
337     RES_TITLE_CHANGED,
338     RES_DESCRIPTION_CHANGED,
339     RES_UNOCURSOR_LEAVES_SECTION,
340     RES_LINKED_GRAPHIC_STREAM_ARRIVED,
341 RES_MSG_END
342 };
343 
344 
345 // eine ID fuer den RTF-Reader. Die Stylesheets werden wie
346 // Attribute behandelt, d.H. es gibt ein StyleSheet Attribut. Um
347 // nicht mit anderen Which()-Werten zu kollidieren, ist der Wert
348 // hier mit aufgefuehrt. (Auch das Hilfesystem definiert neue
349 // Attribute !!)
350 enum RES_FLTRATTR
351 {
352 RES_FLTRATTR_BEGIN = RES_MSG_END,
353 	RES_FLTR_STYLESHEET = RES_FLTRATTR_BEGIN,
354 	RES_FLTR_BOOKMARK,
355 	RES_FLTR_ANCHOR,
356 	RES_FLTR_BORDER,
357 	RES_FLTR_NUMRULE,
358 	RES_FLTR_NUMRULE_NUM,
359 	RES_FLTR_SDR_ANCHOR,
360 	RES_FLTR_TOX,
361 	RES_FLTR_SECTION,
362 	RES_FLTR_REDLINE,
363 	RES_FLTR_SCRIPTTYPE,
364 RES_FLTRATTR_END
365 };
366 
367 #define RES_TBX_DUMMY RES_FLTRATTR_END + 1
368 
369 #define HINT_END RES_TBX_DUMMY
370 
371 // Fehler-Erkennung !!
372 #define INVALID_HINT HINT_END
373 #define RES_WHICHHINT_END HINT_END
374 
375 
376 inline bool isATR(const sal_uInt16 nWhich)
377 {
378     return (RES_CHRATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich);
379 }
380 inline bool isCHRATR(const sal_uInt16 nWhich)
381 {
382     return (RES_CHRATR_BEGIN <= nWhich) && (RES_CHRATR_END > nWhich);
383 }
384 inline bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
385 {
386     return (RES_TXTATR_WITHEND_BEGIN <= nWhich)
387         && (RES_TXTATR_WITHEND_END > nWhich);
388 }
389 inline bool isTXTATR_NOEND(const sal_uInt16 nWhich)
390 {
391     return (RES_TXTATR_NOEND_BEGIN <= nWhich)
392         && (RES_TXTATR_NOEND_END > nWhich);
393 }
394 inline bool isTXTATR(const sal_uInt16 nWhich)
395 {
396     return (RES_TXTATR_BEGIN <= nWhich) && (RES_TXTATR_END > nWhich);
397 }
398 inline bool isPARATR(const sal_uInt16 nWhich)
399 {
400     return (RES_PARATR_BEGIN <= nWhich) && (RES_PARATR_END > nWhich);
401 }
402 inline bool isPARATR_LIST(const sal_uInt16 nWhich)
403 {
404     return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); }
405 inline bool isFRMATR(const sal_uInt16 nWhich)
406 {
407     return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich);
408 }
409 inline bool isGRFATR(const sal_uInt16 nWhich)
410 {
411     return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich);
412 }
413 inline bool isBOXATR(const sal_uInt16 nWhich)
414 {
415     return (RES_BOXATR_BEGIN <= nWhich) && (RES_BOXATR_END > nWhich);
416 }
417 inline bool isUNKNOWNATR(const sal_uInt16 nWhich)
418 {
419     return (RES_UNKNOWNATR_BEGIN <= nWhich) && (RES_UNKNOWNATR_END > nWhich);
420 }
421 
422 
423 /*
424  * hole aus der statischen Default-Attribut Tabelle ueber den Which-Wert
425  * das entsprechende default Attribut.
426  * Ist keines vorhanden, returnt ein 0-Pointer !!!
427  *
428  * Diese Funktion ist im Init.CXX implementiert. Damit die Formate darauf
429  * zugreifen koennen, ist sie hier als extern deklariert.
430  * Im PRODUCT ist das Teil inline.
431  */
432 class SfxPoolItem;
433 struct SfxItemInfo;
434 typedef SfxPoolItem* SwDfltAttrTab[ POOLATTR_END - POOLATTR_BEGIN  ];
435 
436 extern SwDfltAttrTab __FAR_DATA aAttrTab;
437 extern SfxItemInfo	 __FAR_DATA aSlotTab[];
438 
439 SW_DLLPUBLIC const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich );
440 
441 SW_DLLPUBLIC sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript );
442 
443 // return for the given TextAttribut without an end the correct character.
444 // This function returns
445 //		CH_TXTATR_BREAKWORD for Textattribut which breaks a word (default)
446 //		CH_TXTATR_INWORD	for Textattribut which dont breaks a word
447 class SwTxtAttr;
448 sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr );
449 
450 // alle Sets stehen im init.cxx
451 
452 // AttrSet-Range fuer die 3 Break-Attribute
453 extern sal_uInt16 __FAR_DATA aBreakSetRange[];
454 // AttrSet-Range fuer die TxtFmtColl
455 extern sal_uInt16 __FAR_DATA aTxtFmtCollSetRange[];
456 // AttrSet-Range fuer die GrfFmtColl
457 extern sal_uInt16 __FAR_DATA aGrfFmtCollSetRange[];
458 // AttrSet-Range fuer die TextNode
459 SW_DLLPUBLIC extern sal_uInt16 __FAR_DATA aTxtNodeSetRange[];
460 // AttrSet-Range fuer die NoTxtNode
461 extern sal_uInt16 __FAR_DATA aNoTxtNodeSetRange[];
462 // AttrSet-Range fuer die SwTable
463 extern sal_uInt16 __FAR_DATA aTableSetRange[];
464 // AttrSet-Range fuer die SwTableLine
465 extern sal_uInt16 __FAR_DATA aTableLineSetRange[];
466 // AttrSet-Range fuer die SwTableBox
467 extern sal_uInt16 __FAR_DATA aTableBoxSetRange[];
468 // AttrSet-Range fuer die SwFrmFmt
469 SW_DLLPUBLIC extern sal_uInt16 __FAR_DATA aFrmFmtSetRange[];
470 // AttrSet-Range fuer die SwCharFmt
471 extern sal_uInt16 __FAR_DATA aCharFmtSetRange[];
472 // AttrSet-Range fuer die character autostyles
473 extern sal_uInt16 __FAR_DATA aCharAutoFmtSetRange[];
474 // AttrSet-Range fuer die SwPageDescFmt
475 extern sal_uInt16 __FAR_DATA aPgFrmFmtSetRange[];
476 
477 // check if ID is InRange of AttrSet-Ids
478 sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId );
479 
480 #endif
481