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