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