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