bump product version to 5.0.4.1
[LibreOffice.git] / sw / inc / swtypes.hxx
blobb724fbdc3313ff91c4362d2d184f39205469da29
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SWTYPES_HXX
20 #define INCLUDED_SW_INC_SWTYPES_HXX
21 #include <rtl/ustring.hxx>
22 #include <tools/solar.h>
23 #include <tools/mapunit.hxx>
24 #include <SwGetPoolIdFromName.hxx>
26 #include <limits.h>
27 #include <com/sun/star/uno/Reference.h>
28 #include "swdllapi.h"
29 #include <i18nlangtag/languagetag.hxx>
30 #include <o3tl/typed_flags_set.hxx>
32 namespace com { namespace sun { namespace star {
33 namespace linguistic2{
34 class XDictionaryList;
35 class XLinguProperties;
36 class XSpellChecker1;
37 class XHyphenator;
38 class XThesaurus;
40 namespace beans{
41 class XPropertySet;
43 }}}
44 namespace utl{
45 class TransliterationWrapper;
48 class Size;
49 class ResMgr;
50 class SwPathFinder;
51 class Graphic;
52 class OutputDevice;
53 class CharClass;
54 class LocaleDataWrapper;
55 class CollatorWrapper;
57 typedef long SwTwips;
58 #define INVALID_TWIPS LONG_MAX
59 #define TWIPS_MAX (LONG_MAX - 1)
61 #define MM50 283 // 1/2 cm in TWIPS.
63 const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32;
65 const SwTwips cMinHdFtHeight = 56;
67 #define MINFLY 23 // Minimal size for FlyFrms.
68 #define MINLAY 23 // Minimal size for other Frms.
70 // Default column distance of two text columns corresponds to 0.3 cm.
71 #define DEF_GUTTER_WIDTH (MM50 / 5 * 3)
73 // Minimal distance (distance to text) for border attribute
74 // in order not to crock up aligned lines.
75 // 28 Twips == 0,4mm
76 #define MIN_BORDER_DIST 28
78 // Minimal document border.
79 const SwTwips lMinBorder = 1134;
81 // Margin left and above document.
82 // Half of it is gap between the pages.
83 #define DOCUMENTBORDER 284L
84 #define GAPBETWEENPAGES 284L
86 // Constant strings.
87 SW_DLLPUBLIC extern OUString aEmptyOUStr; // remove once aEmptyOUStr can be changed to OUString
89 // For inserting of captions (what and where to insert).
90 // It's here because it is not big enough to justify its own hxx
91 // and does not seem to fit somewhere else.
92 enum SwLabelType
94 LTYPE_TABLE, // Caption for a table.
95 LTYPE_OBJECT, // Caption for a graphic or OLE.
96 LTYPE_FLY, // Caption for a text frame.
97 LTYPE_DRAW // Caption for a draw object.
100 const sal_uInt8 MAXLEVEL = 10;
102 const sal_uInt8 NO_NUMLEVEL = 0x20; // "or" with the levels.
104 // Some helper functions as macros or inlines.
106 // One kilobyte is 1024 bytes:
107 #define KB 1024
109 #define SET_CURR_SHELL( shell ) CurrShell aCurr( shell )
111 // pPathFinder is initialized by the UI.
112 // The class delivers all paths needed.
113 extern SwPathFinder *pPathFinder;
115 // Values for indents at numbering and bullet lists.
116 // (For more levels the values have to be multiplied with the levels+1;
117 // levels 0 ..4!)
119 const sal_uInt16 lBullIndent = 1440/4;
120 const short lBullFirstLineOffset = -lBullIndent;
121 const sal_uInt16 lNumIndent = 1440/4;
122 const short lNumFirstLineOffset = -lNumIndent;
123 const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm
125 // Count of SystemField-types of SwDoc.
126 #define INIT_FLDTYPES 32
128 // Count of predefined Seq-field types. It is always the last
129 // fields before INIT_FLDTYPES.
130 #define INIT_SEQ_FLDTYPES 4
132 // The former Rendevouz-IDs live on:
133 // There are IDs for the anchors (SwFormatAnchor) and some others
134 // that are only of importance for interfaces (SwDoc).
135 enum RndStdIds
137 FLY_AT_PARA, // Anchored at paragraph.
138 FLY_AS_CHAR, // Anchored as character.
139 FLY_AT_PAGE, // Anchored at page.
140 FLY_AT_FLY, // Anchored at frame.
141 FLY_AT_CHAR, // Anchored at character.
143 RND_STD_HEADER,
144 RND_STD_FOOTER,
145 RND_STD_HEADERL,
146 RND_STD_HEADERR,
147 RND_STD_FOOTERL,
148 RND_STD_FOOTERR,
150 RND_DRAW_OBJECT // A draw-Object! For the SwDoc-interface only!
153 extern ResMgr* pSwResMgr; // Is in swapp0.cxx.
154 #define SW_RES(i) ResId(i,*pSwResMgr)
155 #define SW_RESSTR(i) SW_RES(i).toString()
157 ::com::sun::star::uno::Reference<
158 ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
159 ::com::sun::star::uno::Reference<
160 ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
161 ::com::sun::star::uno::Reference<
162 ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
163 ::com::sun::star::uno::Reference<
164 ::com::sun::star::linguistic2::XLinguProperties > GetLinguPropertySet();
166 // Returns the twip size of this graphic.
167 SW_DLLPUBLIC Size GetGraphicSizeTwip( const Graphic&, OutputDevice* pOutDev );
169 // Separator for jumps to different content types in document.
170 const sal_Unicode cMarkSeparator = '|';
171 // Sequences names for jumps are <name of sequence>!<no>
172 const char cSequenceMarkSeparator = '!';
174 #define DB_DELIM ((sal_Unicode)0xff) // Database <-> table separator.
176 enum class SetAttrMode
178 DEFAULT = 0x0000, // Default.
179 /// @attention: DONTEXPAND does not work very well for CHARATR
180 /// because it can expand only the whole AUTOFMT or nothing
181 DONTEXPAND = 0x0001, // Don't expand text attribute any further.
182 DONTREPLACE = 0x0002, // Don't replace another text attribute.
184 NOTXTATRCHR = 0x0004, // Don't insert 0xFF at attributes with no end.
185 /// attention: NOHINTADJUST prevents MergePortions!
186 /// when using this need to pay attention to ignore start/end flags of hint
187 NOHINTADJUST = 0x0008, // No merging of ranges.
188 NOFORMATATTR = 0x0010, // Do not change into format attribute.
189 DONTCHGNUMRULE = 0x0020, // Do not change NumRule.
190 APICALL = 0x0040, // Called from API (all UI related
191 // functionality will be disabled).
192 /// Force hint expand (only matters for hints with CH_TXTATR).
193 FORCEHINTEXPAND = 0x0080,
194 /// The inserted item is a copy -- intended for use in ndtxt.cxx.
195 IS_COPY = 0x0100
197 namespace o3tl
199 template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x1ff> {};
202 #define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c )
204 #ifndef SW_CONSTASCII_DECL
205 #define SW_CONSTASCII_DECL( n, s ) n[sizeof(s)]
206 #endif
207 #ifndef SW_CONSTASCII_DEF
208 #define SW_CONSTASCII_DEF( n, s ) n[sizeof(s)] = s
209 #endif
211 #define CHAR_HARDBLANK ((sal_Unicode)0x00A0)
212 #define CHAR_HARDHYPHEN ((sal_Unicode)0x2011)
213 #define CHAR_SOFTHYPHEN ((sal_Unicode)0x00AD)
214 #define CHAR_RLM ((sal_Unicode)0x200F)
215 #define CHAR_LRM ((sal_Unicode)0x200E)
216 #define CHAR_ZWSP ((sal_Unicode)0x200B)
217 #define CHAR_ZWNBSP ((sal_Unicode)0x2060)
219 // Returns the APP - CharClass instance - used for all ToUpper/ToLower/...
220 SW_DLLPUBLIC CharClass& GetAppCharClass();
221 SW_DLLPUBLIC LanguageType GetAppLanguage();
222 SW_DLLPUBLIC const LanguageTag& GetAppLanguageTag();
224 #if 0
225 // I18N doesn't get this right, can't specify more than one to ignore
226 #define SW_COLLATOR_IGNORES ( \
227 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \
228 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \
229 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH )
230 #else
231 #define SW_COLLATOR_IGNORES ( \
232 ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
233 #endif
235 SW_DLLPUBLIC CollatorWrapper& GetAppCollator();
236 SW_DLLPUBLIC CollatorWrapper& GetAppCaseCollator();
238 SW_DLLPUBLIC const ::utl::TransliterationWrapper& GetAppCmpStrIgnore();
240 // Official shortcut for Prepare() regarding notification of Content by the Layout.
241 // Content provides for calculation of minimal requirements at the next call of ::Format().
242 enum PrepareHint
244 PREP_BEGIN, // BEGIN.
245 PREP_CLEAR = PREP_BEGIN,// Reformat completely.
246 PREP_WIDOWS_ORPHANS, // Only check for widows and orphans and split in case of need.
247 PREP_FIXSIZE_CHG, // FixSize has changed.
248 PREP_FOLLOW_FOLLOWS, // Follow is now possibly adjacent.
249 PREP_ADJUST_FRM, // Adjust size via grow/shrink without formatting.
250 PREP_FLY_CHGD, // A FlyFrm has changed its size.
251 PREP_FLY_ATTR_CHG, // A FlyFrm hat has changed its attributes
252 // (e. g. wrap).
253 PREP_FLY_ARRIVE, // A FlyFrm now overlaps range.
254 PREP_FLY_LEAVE, // A FlyFrm has left range.
255 PREP_FTN, // Invalidation of footnotes.
256 PREP_POS_CHGD, // Position of Frm has changed.
257 // (Check for Fly-break). In void* of Prepare()
258 // a sal_Bool& is passed. If this is sal_True,
259 // it indicateds that a format has been executed.
260 PREP_UL_SPACE, // UL-Space has changed, TextFrms have to
261 // re-calculate line space.
262 PREP_MUST_FIT, // Make frm fit (split) even if the attributes do
263 // not allow that (e.g. "keep together").
264 PREP_WIDOWS, // A follow realizes that the orphan rule will be applied
265 // for it and sends a PREP_WIDOWS to its predecessor
266 // (Master/Follow).
267 PREP_QUOVADIS, // If a footnote has to be split between two paragraphs
268 // the last on the page has to receive a QUOVADIS in
269 // order to format the text into it.
270 PREP_BOSS_CHGD, // If a Frm changes its column/page this additional
271 // Prepare is sended to POS_CHGD in MoveFwd/Bwd
272 // (join Footnote-numbers etc.)
273 // Direction is communicated via pVoid:
274 // MoveFwd: pVoid == 0
275 // MoveBwd: pVoid == pOldPage
276 PREP_SWAP, // Swap graphic; for graphics in visible area.
277 PREP_REGISTER, // Invalidate frames with registers.
278 PREP_FTN_GONE, // A Follow loses its footnote, possibly its first line can move up.
279 PREP_MOVEFTN, // A footnote changes its page. Its contents receives at first a
280 // height of zero in order to avoid too much noise. At formatting
281 // it checks whether it fits and if necessary changes its page again.
282 PREP_ERGOSUM, // Needed because of movement in FootnoteFrms. Check QuoVadis/ErgoSum.
283 PREP_END // END.
286 #endif
288 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */