Branch libreoffice-5-0-4
[LibreOffice.git] / include / editeng / editstat.hxx
blobb53c744c309229633362f97d7676e1d20487436f
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 .
20 #ifndef INCLUDED_EDITENG_EDITSTAT_HXX
21 #define INCLUDED_EDITENG_EDITSTAT_HXX
23 #include <rtl/ustring.hxx>
24 #include <tools/solar.h>
25 #include <i18nlangtag/lang.h>
26 #include <o3tl/typed_flags_set.hxx>
28 enum class EEControlBits
30 NONE = 0x00000000,
31 USECHARATTRIBS = 0x00000001, // Use of hard character attributes
32 USEPARAATTRIBS = 0x00000002, // Using paragraph attributes.
33 CRSRLEFTPARA = 0x00000004, // Cursor is moved to another paragraph
34 DOIDLEFORMAT = 0x00000008, // Formatting idle
35 PASTESPECIAL = 0x00000010, // Allow PasteSpecial
36 AUTOINDENTING = 0x00000020, // Automatic indenting
37 UNDOATTRIBS = 0x00000040, // Undo for Attributes....
38 ONECHARPERLINE = 0x00000080, // One character per line
39 NOCOLORS = 0x00000100, // Engine: No Color
40 OUTLINER = 0x00000200, // Special treatment Outliner/Outline mode
41 OUTLINER2 = 0x00000400, // Special treatment Outliner/Page
42 ALLOWBIGOBJS = 0x00000800, // Portion info in text object
43 ONLINESPELLING = 0x00001000, // During the edit Spelling
44 STRETCHING = 0x00002000, // Stretch mode
45 MARKFIELDS = 0x00004000, // Mark Fields with color
46 RESTOREFONT = 0x00010000, // Restore Font in OutDev
47 RTFSTYLESHEETS = 0x00020000, // Use Stylesheets when imported
48 AUTOCORRECT = 0x00080000, // AutoCorrect
49 AUTOCOMPLETE = 0x00100000, // AutoComplete
50 AUTOPAGESIZEX = 0x00200000, // Adjust paper width to Text
51 AUTOPAGESIZEY = 0x00400000, // Adjust paper height to Text
52 AUTOPAGESIZE = (AUTOPAGESIZEX | AUTOPAGESIZEY),
53 TABINDENTING = 0x00800000, // Indent with tab
54 FORMAT100 = 0x01000000, // Always format to 100%
55 ULSPACESUMMATION = 0x02000000, // MS Compat: sum SA and SB, not maximum value
56 ULSPACEFIRSTPARA = 0x04000000, // MS Compat: evaluate also at the first paragraph
58 namespace o3tl
60 template<> struct typed_flags<EEControlBits> : is_typed_flags<EEControlBits, 0x07ffffff> {};
63 enum class EVControlBits
65 AUTOSCROLL = 0x0001, // Auto scrolling horizontally
66 BIGSCROLL = 0x0002, // Scroll further to the cursor
67 ENABLEPASTE = 0x0004, // Enable Paste
68 SINGLELINEPASTE = 0x0008, // View: Paste in input line ...
69 OVERWRITE = 0x0010, // Overwrite mode
70 INVONEMORE = 0x0020, // Invalidate one pixel more
71 AUTOSIZEX = 0x0040, // Automatically adapt to text width
72 AUTOSIZEY = 0x0080, // Automatically adapt to Text width
73 AUTOSIZE = (AUTOSIZEX|AUTOSIZEY)
75 namespace o3tl
77 template<> struct typed_flags<EVControlBits> : is_typed_flags<EVControlBits, 0xff> {};
80 enum class EditStatusFlags
82 NONE = 0x0000,
83 HSCROLL = 0x0001,
84 VSCROLL = 0x0002,
85 CURSOROUT = 0x0004,
86 CRSRMOVEFAIL = 0x0008,
87 CRSRLEFTPARA = 0x0010,
88 TEXTWIDTHCHANGED = 0x0020,
89 TEXTHEIGHTCHANGED = 0x0040,
90 WRONGWORDCHANGED = 0x0080
92 namespace o3tl
94 template<> struct typed_flags<EditStatusFlags> : is_typed_flags<EditStatusFlags, 0xff> {};
98 EditStatusFlags::CRSRLEFTPARA at the time cursor movement and the enter.
101 inline void SetFlags( EEControlBits& rBits, EEControlBits nMask, bool bOn )
103 if ( bOn )
104 rBits |= nMask;
105 else
106 rBits &= ~nMask;
109 inline void SetFlags( EVControlBits& rBits, EVControlBits nMask, bool bOn )
111 if ( bOn )
112 rBits |= nMask;
113 else
114 rBits &= ~nMask;
117 class EditStatus
119 protected:
120 EditStatusFlags nStatusBits;
121 EEControlBits nControlBits;
122 sal_Int32 nPrevPara; // for EditStatusFlags::CRSRLEFTPARA
124 public:
125 EditStatus() { nStatusBits = EditStatusFlags::NONE; nControlBits = EEControlBits::NONE; nPrevPara = -1; }
127 void Clear() { nStatusBits = EditStatusFlags::NONE; }
128 void SetControlBits( EEControlBits nMask, bool bOn )
129 { SetFlags( nControlBits, nMask, bOn ); }
131 EditStatusFlags GetStatusWord() const { return nStatusBits; }
132 EditStatusFlags& GetStatusWord() { return nStatusBits; }
134 EEControlBits GetControlWord() const { return nControlBits; }
135 EEControlBits& GetControlWord() { return nControlBits; }
137 sal_Int32 GetPrevParagraph() const { return nPrevPara; }
138 sal_Int32& GetPrevParagraph() { return nPrevPara; }
141 enum class SpellCallbackCommand
143 IGNOREWORD = 0x0001,
144 STARTSPELLDLG = 0x0002,
145 ADDTODICTIONARY = 0x0003,
146 WORDLANGUAGE = 0x0004,
147 PARALANGUAGE = 0x0005,
150 struct SpellCallbackInfo
152 SpellCallbackCommand nCommand;
153 OUString aWord;
154 LanguageType eLanguage;
156 SpellCallbackInfo( SpellCallbackCommand nCMD, const OUString& rWord )
157 : aWord( rWord )
159 nCommand = nCMD;
160 eLanguage = LANGUAGE_DONTKNOW;
163 SpellCallbackInfo( SpellCallbackCommand nCMD, LanguageType eLang )
165 nCommand = nCMD;
166 eLanguage = eLang;
170 #endif // INCLUDED_EDITENG_EDITSTAT_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */