LibreOffice Module sw (master) 1
swtypes.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SW_INC_SWTYPES_HXX
20#define INCLUDED_SW_INC_SWTYPES_HXX
21#include <rtl/ustring.hxx>
22
23#include <limits.h>
24#include <com/sun/star/uno/Reference.h>
25#include <com/sun/star/i18n/CollatorOptions.hpp>
26#include "swdllapi.h"
29#include <i18nlangtag/lang.h>
30#include <vcl/outdev.hxx>
31#include <unotools/resmgr.hxx>
32
33namespace com::sun::star {
34 namespace linguistic2{
35 class XLinguProperties;
36 class XSpellChecker1;
37 class XHyphenator;
38 class XThesaurus;
39 }
40}
41namespace utl{
42 class TransliterationWrapper;
43}
44
45class Size;
46class SwPathFinder;
47class Graphic;
48class OutputDevice;
49class CharClass;
50class CollatorWrapper;
51class LanguageTag;
52
54#define INVALID_TWIPS LONG_MAX
55#define TWIPS_MAX (LONG_MAX - 1)
56
57constexpr sal_Int32 COMPLETE_STRING = SAL_MAX_INT32;
58
59constexpr SwTwips cMinHdFtHeight = 56; // ~1mm
60
61#define MINFLY 23 // Minimal size for FlyFrames.
62#define MINLAY 23 // Minimal size for other Frames.
63
64// Default column distance of two text columns corresponds to 0.3 cm.
66
67// Minimal distance (distance to text) for border attribute
68// in order not to crock up aligned lines.
69// 28 Twips == 0,5mm
70constexpr SwTwips MIN_BORDER_DIST = 28; // ~0.5mm
71
72// Minimal document border: 20mm.
75
76// Margin left and above document.
77// Half of it is gap between the pages.
78//TODO: Replace with SwViewOption::defDocumentBorder
79constexpr SwTwips DOCUMENTBORDER = 284; // ~5mm
80
81// For inserting of captions (what and where to insert).
82// It's here because it is not big enough to justify its own hxx
83// and does not seem to fit somewhere else.
84enum class SwLabelType
85{
86 Table, // Caption for a table.
87 Object, // Caption for a graphic or OLE.
88 Fly, // Caption for a text frame.
89 Draw // Caption for a draw object.
90};
91
92constexpr sal_uInt8 MAXLEVEL = 10;
93
94// Values for indents at numbering and bullet lists.
95// (For more levels the values have to be multiplied with the levels+1;
96// levels 0 ..4!)
97
98constexpr short lBulletIndent = o3tl::toTwips(25, o3tl::Length::in100); // 0.25 inch
100constexpr sal_uInt16 lNumberIndent = o3tl::toTwips(25, o3tl::Length::in100); // 0.25 inch
102constexpr short lOutlineMinTextDistance = o3tl::toTwips(15, o3tl::Length::in100); // 0.15 inch = 0.38 cm
103
104// Count of SystemField-types of SwDoc.
105#define INIT_FLDTYPES 33
106
107// Count of predefined Seq-field types. It is always the last
108// fields before INIT_FLDTYPES.
109#define INIT_SEQ_FLDTYPES 5
110
111// defined in sw/source/uibase/app/swmodule.cxx
112SW_DLLPUBLIC OUString SwResId(TranslateId aId);
113OUString SwResId(TranslateNId aContextSingularPlural, int nCardinality);
114
115css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker();
116css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator();
117css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus();
118css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet();
119
120// Returns the twip size of this graphic.
122
123// Separator for jumps to different content types in document.
125// Sequences names for jumps are <name of sequence>!<no>
126const char cSequenceMarkSeparator = '!';
129
130#define DB_DELIM u'\x00ff' // Database <-> table separator.
131
132enum class SetAttrMode
133{
134 DEFAULT = 0x0000, // Default.
137 DONTEXPAND = 0x0001, // Don't expand text attribute any further.
138 DONTREPLACE = 0x0002, // Don't replace another text attribute.
139
140 NOTXTATRCHR = 0x0004, // Don't insert 0xFF at attributes with no end.
143 NOHINTADJUST = 0x0008, // No merging of ranges.
144 NOFORMATATTR = 0x0010, // Do not change into format attribute.
145 APICALL = 0x0020, // Called from API (all UI related
146 // functionality will be disabled).
148 FORCEHINTEXPAND = 0x0040,
150 IS_COPY = 0x0080,
152 NOHINTEXPAND = 0x0100,
154 NO_CURSOR_CHANGE = 0x0200
155};
156namespace o3tl
157{
158 template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x3ff> {};
159}
160
161namespace sw {
162
163enum class GetTextAttrMode {
164 Default,
165 Expand,
166 Parent,
167};
168
169} // namespace sw
170
171constexpr bool SW_ISPRINTABLE(sal_Unicode c) { return c >= ' ' && 127 != c; }
172
173#define CHAR_HARDBLANK u'\x00A0'
174#define CHAR_HARDHYPHEN u'\x2011'
175#define CHAR_SOFTHYPHEN u'\x00AD'
176#define CHAR_RLM u'\x200F'
177#define CHAR_LRM u'\x200E'
178#define CHAR_ZWSP u'\x200B'
179#define CHAR_WJ u'\x2060'
180#define CHAR_NNBSP u'\x202F' //NARROW NO-BREAK SPACE
181
182// Returns the APP - CharClass instance - used for all ToUpper/ToLower/...
186
187#if 0
188// I18N doesn't get this right, can't specify more than one to ignore
189#define SW_COLLATOR_IGNORES ( \
190 css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \
191 css::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \
192 css::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH )
193#else
194#define SW_COLLATOR_IGNORES ( \
195 css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
196#endif
197
200
201SW_DLLPUBLIC const ::utl::TransliterationWrapper& GetAppCmpStrIgnore();
202
203// Official shortcut for Prepare() regarding notification of Content by the Layout.
204// Content provides for calculation of minimal requirements at the next call of ::Format().
205enum class PrepareHint
206{
207 Clear, // Reformat completely.
208 WidowsOrphans, // Only check for widows and orphans and split in case of need.
209 FixSizeChanged, // FixSize has changed.
210 FollowFollows, // Follow is now possibly adjacent.
211 AdjustSizeWithoutFormatting, // Adjust size via grow/shrink without formatting.
212 FlyFrameSizeChanged, // A FlyFrame has changed its size.
213 FlyFrameAttributesChanged, // A FlyFrame has changed its attributes (e. g. wrap).
214 FlyFrameArrive, // A FlyFrame now overlaps range.
215 FlyFrameLeave, // A FlyFrame has left range.
216 FootnoteInvalidation, // Invalidation of footnotes.
217 FramePositionChanged, // Position of Frame has changed.
218 // (Check for Fly-break). In void* of Prepare()
219 // a sal_Bool& is passed. If this is sal_True,
220 // it indicates that a format has been executed.
221 ULSpaceChanged, // UL-Space has changed, TextFrames have to
222 // re-calculate line space.
223 MustFit, // Make frm fit (split) even if the attributes do
224 // not allow that (e.g. "keep together").
225 Widows, // A follow realizes that the orphan rule will be applied
226 // for it and sends a Widows to its predecessor
227 // (Master/Follow).
228 QuoVadis, // If a footnote has to be split between two paragraphs
229 // the last on the page has to receive a QUOVADIS in
230 // order to format the text into it.
231 BossChanged, // If a Frame changes its column/page this additional
232 // Prepare is sent to POS_CHGD in MoveFwd/Bwd
233 // (join Footnote-numbers etc.)
234 // Direction is communicated via pVoid:
235 // MoveFwd: pVoid == 0
236 // MoveBwd: pVoid == pOldPage
237 Register, // Invalidate frames with registers.
238 FootnoteInvalidationGone, // A Follow loses its footnote, possibly its first line can move up.
239 FootnoteMove, // A footnote changes its page. Its contents receives at first a
240 // height of zero in order to avoid too much noise. At formatting
241 // it checks whether it fits and if necessary changes its page again.
242 ErgoSum, // Needed because of movement in FootnoteFrames. Check QuoVadis/ErgoSum.
243};
244
246{
247 PageBreak,
248 Header,
249 Footer,
252 Outline
253};
254
255#endif
256
257/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Clear(EHistoryType eHistory)
constexpr auto toTwips(N number, Length from)
Header
Footer
Dialog to specify the properties of date form field.
GetTextAttrMode
Definition: swtypes.hxx:163
long Long
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SetAttrMode
Definition: swtypes.hxx:133
@ NO_CURSOR_CHANGE
don't change the cursor position
@ IS_COPY
The inserted item is a copy – intended for use in ndtxt.cxx.
@ NOHINTADJUST
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
SW_DLLPUBLIC Size GetGraphicSizeTwip(const Graphic &, vcl::RenderContext *pOutDev)
Definition: swtypes.cxx:28
constexpr sal_uInt16 lNumberIndent
Definition: swtypes.hxx:100
constexpr SwTwips DEF_GUTTER_WIDTH
Definition: swtypes.hxx:65
SW_DLLPUBLICconst ::utl::TransliterationWrapper & GetAppCmpStrIgnore()
Definition: init.cxx:802
tools::Long SwTwips
Definition: swtypes.hxx:51
SwLabelType
Definition: swtypes.hxx:85
constexpr short lNumberFirstLineOffset
Definition: swtypes.hxx:101
constexpr short lBulletIndent
Definition: swtypes.hxx:98
constexpr SwTwips cMinHdFtHeight
Definition: swtypes.hxx:59
constexpr short lOutlineMinTextDistance
Definition: swtypes.hxx:102
constexpr bool SW_ISPRINTABLE(sal_Unicode c)
Definition: swtypes.hxx:171
SW_DLLPUBLIC const LanguageTag & GetAppLanguageTag()
Definition: init.cxx:748
css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus()
Definition: swtypes.cxx:59
css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker()
Definition: swtypes.cxx:52
SW_DLLPUBLIC LanguageType GetAppLanguage()
Definition: init.cxx:741
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet()
Definition: swtypes.cxx:61
CollatorWrapper & GetAppCaseCollator()
Definition: init.cxx:765
sal_Unicode const toxMarkSeparator
separator for toxmarks: #<no>%19<text>%19<type><typename>|toxmark
Definition: swtypes.hxx:128
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
const char cSequenceMarkSeparator
Definition: swtypes.hxx:126
PrepareHint
Definition: swtypes.hxx:206
@ FramePositionChanged
@ FootnoteInvalidation
@ FlyFrameAttributesChanged
@ FootnoteInvalidationGone
@ AdjustSizeWithoutFormatting
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:124
SW_DLLPUBLIC CharClass & GetAppCharClass()
Definition: init.cxx:721
constexpr short lBulletFirstLineOffset
Definition: swtypes.hxx:99
constexpr SwTwips MIN_BORDER_DIST
Definition: swtypes.hxx:70
constexpr SwTwips lMinBorder
Definition: swtypes.hxx:74
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
SW_DLLPUBLIC CollatorWrapper & GetAppCollator()
Definition: init.cxx:753
constexpr tools::Long lMinBorderInMm(20)
css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator()
Definition: swtypes.cxx:57
FrameControlType
Definition: swtypes.hxx:246
SW_DLLPUBLIC OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
unsigned char sal_uInt8
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode