Line data Source code
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 :
20 : #ifndef INCLUDED_SW_INC_VIEWOPT_HXX
21 : #define INCLUDED_SW_INC_VIEWOPT_HXX
22 :
23 : #include <config_features.h>
24 :
25 : #include <tools/gen.hxx>
26 : #include <tools/color.hxx>
27 :
28 : #include <sfx2/zoomitem.hxx>
29 : #include <svx/svxids.hrc>
30 : #include "swdllapi.h"
31 : #include "authratr.hxx"
32 :
33 : class SwRect;
34 : namespace vcl { class Window; }
35 : class OutputDevice;
36 : class SwViewShell;
37 : class SwDocShell;
38 : namespace svtools{ class ColorConfig;}
39 :
40 : #define VIEWOPT_1_TAB 0x00000002L
41 : #define VIEWOPT_1_BLANK 0x00000004L
42 : #define VIEWOPT_1_HARDBLANK 0x00000008L
43 : #define VIEWOPT_1_PARAGRAPH 0x00000010L
44 : #define VIEWOPT_1_LINEBREAK 0x00000020L
45 : #define VIEWOPT_1_PAGEBREAK 0x00000040L
46 : #define VIEWOPT_1_COLUMNBREAK 0x00000080L
47 : #define VIEWOPT_1_SOFTHYPH 0x00000100L
48 :
49 : #define VIEWOPT_1_REF 0x00000400L
50 : #define VIEWOPT_1_FLDNAME 0x00000800L
51 : #define VIEWOPT_1_POSTITS 0x00004000L
52 : #define VIEWOPT_1_FLD_HIDDEN 0x00008000L
53 : #define VIEWOPT_1_CHAR_HIDDEN 0x00010000L
54 : #define VIEWOPT_1_GRAPHIC 0x00020000L
55 : #define VIEWOPT_1_TABLE 0x00040000L
56 : #define VIEWOPT_1_DRAW 0x00080000L
57 : #define VIEWOPT_1_CONTROL 0x00100000L
58 : #define VIEWOPT_1_CROSSHAIR 0x00400000L
59 : #define VIEWOPT_1_SNAP 0x00800000L
60 : #define VIEWOPT_1_SYNCHRONIZE 0x01000000L
61 : #define VIEWOPT_1_GRIDVISIBLE 0x02000000L
62 : #define VIEWOPT_1_ONLINESPELL 0x04000000L
63 : #define VIEWOPT_1_RESERVED1 0x10000000L
64 : #define VIEWOPT_1_VIEWMETACHARS 0x20000000L
65 : #define VIEWOPT_1_PAGEBACK 0x40000000L
66 :
67 : #define VIEWOPT_CORE2_BLACKFONT 0x00000001L
68 : #define VIEWOPT_CORE2_HIDDENPARA 0x00000002L
69 : #define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L
70 : #define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L
71 : #define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L
72 : #define VIEWOPT_CORE2_PRINTING 0x00000020L
73 :
74 : #define VIEWOPT_2_UNUSED1 0x00000100L
75 : #define VIEWOPT_2_UNUSED2 0x00000200L
76 : #define VIEWOPT_2_H_RULER 0x00000400L
77 : #define VIEWOPT_2_VSCROLLBAR 0x00000800L
78 : #define VIEWOPT_2_HSCROLLBAR 0x00001000L
79 : #define VIEWOPT_2_STATUSLINE 0x00002000L
80 : #define VIEWOPT_2_V_RULER 0x00004000L
81 : #define VIEWOPT_2_ANY_RULER 0x00008000L
82 : #define VIEWOPT_2_MODIFIED 0x00010000L
83 : #define VIEWOPT_2_KEEPASPECTRATIO 0x00020000L
84 : #define VIEWOPT_2_GRFKEEPZOOM 0x00040000L
85 : #define VIEWOPT_2_CONTENT_TIPS 0x00100000L
86 : #define VIEWOPT_2_RESERVED3 0x00200000L
87 : #define VIEWOPT_2_SCROLLBAR_TIPS 0x00400000L
88 : #define VIEWOPT_2_PRTFORMAT 0x00800000L
89 : #define VIEWOPT_2_SHADOWCRSR 0x01000000L
90 : #define VIEWOPT_2_V_RULER_RIGHT 0x02000000L
91 :
92 : // Table background.
93 : #define TBL_DEST_CELL 0
94 : #define TBL_DEST_ROW 1
95 : #define TBL_DEST_TBL 2
96 :
97 : // Appearance flags.
98 : #define VIEWOPT_DOC_BOUNDARIES 0x0001
99 : #define VIEWOPT_OBJECT_BOUNDARIES 0x0002
100 : #define VIEWOPT_TABLE_BOUNDARIES 0x0004
101 : #define VIEWOPT_INDEX_SHADINGS 0x0008
102 : #define VIEWOPT_LINKS 0x0010
103 : #define VIEWOPT_VISITED_LINKS 0x0020
104 : #define VIEWOPT_FIELD_SHADINGS 0x0040
105 : #define VIEWOPT_SECTION_BOUNDARIES 0x0080
106 : #define VIEWOPT_SHADOW 0x0100
107 :
108 : // Implementation in core/text/txtpaint.cxx.
109 : extern void SyncVout( const OutputDevice *pOut );
110 :
111 : class SwViewOption
112 : {
113 : static Color aDocColor; // color of document boundaries
114 : static Color aDocBoundColor; // color of document boundaries
115 : static Color aObjectBoundColor; // color of object boundaries
116 : static Color aAppBackgroundColor; // application background
117 : static Color aTableBoundColor; // color of table boundaries
118 : static Color aFontColor;
119 : static Color aIndexShadingsColor; // background color of indexes
120 : static Color aLinksColor;
121 : static Color aVisitedLinksColor;
122 : static Color aDirectCursorColor;
123 : static Color aTextGridColor;
124 : static Color aSpellColor; // mark color of online spell checking
125 : static Color aSmarttagColor;
126 : static Color aFieldShadingsColor;
127 : static Color aSectionBoundColor;
128 : static Color aPageBreakColor;
129 : static Color aScriptIndicatorColor;
130 : static Color aShadowColor;
131 : static Color aHeaderFooterMarkColor;
132 :
133 : static sal_Int32 nAppearanceFlags;
134 : protected:
135 : static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
136 :
137 : OUString sSymbolFont; // Symbolfont.
138 : sal_uInt32 nCoreOptions; // Bits for SwViewShell.
139 : sal_uInt32 nCore2Options; // Bits for SwViewShell.
140 : sal_uInt32 nUIOptions; // UI-Bits
141 : Color aRetoucheColor; // DefaultBackground for BrowseView
142 : Size aSnapSize; // Describes horizontal and vertical snap.
143 : sal_uInt16 mnViewLayoutColumns;// # columns for edit view
144 : short nDivisionX; // Grid division.
145 : short nDivisionY;
146 : sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
147 : sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
148 : sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
149 : bool bReadonly : 1; // Readonly-Doc.
150 : bool bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
151 : bool bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
152 : bool bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents.
153 : bool mbFormView : 1;
154 : bool mbBrowseMode : 1;
155 : bool mbBookView : 1; // View mode for page preview.
156 : bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
157 : bool bShowPlaceHolderFields : 1; // Only used in printing!
158 : mutable bool bIdle;
159 :
160 : // Scale
161 : sal_uInt16 nZoom; // In percent.
162 : SvxZoomType eZoom; // 'enum' for zoom.
163 :
164 : sal_uInt8 nTblDest; // Destination for table background.
165 :
166 : #ifdef DBG_UTIL
167 : // Corresponds to statements in ui/config/cfgvw.src.
168 : bool m_bTest1 :1; // Test-flag "Layout not loading"
169 : bool m_bTest2 :1; // Test-flag "WYSIWYG++"
170 : bool m_bTest3 :1; // Test-flag ""
171 : bool m_bTest4 :1; // Test-flag "WYSIWYG debug"
172 : bool m_bTest5 :1; // Test-flag "No idle format"
173 : bool m_bTest6 :1; // Test-flag "No screen adj"
174 : bool m_bTest7 :1; // Test-flag "win format"
175 : bool m_bTest8 :1; // Test-flag ""
176 : static bool s_bTest9; // Test-Flag "DrawingLayerNotLoading"
177 : bool m_bTest10 :1; // Test-Flag "Format by Input"
178 : #endif
179 :
180 : public:
181 : SwViewOption(); // CTOR
182 : SwViewOption(const SwViewOption&);
183 : ~SwViewOption();
184 :
185 : void Init( vcl::Window *pWin ); // Initializing of static data.
186 :
187 0 : sal_uInt16 GetPixelTwips() const { return nPixelTwips; }
188 :
189 0 : inline sal_uInt32 GetCoreOptions() const {return nCoreOptions;}
190 : inline void SetUIOptions( const SwViewOption& );
191 :
192 : // Options from nCoreOptions
193 637 : inline bool IsIdle() const
194 637 : { return bIdle; }
195 :
196 : // Logically this is a const function since it does not modify the viewoptions
197 : // but only effects idle formatting. Of course that member is already implement
198 : // in the wrong place here... Also currently there are many const modifying casts in the code
199 : // just to call this function on otherwise const objects. Thus declaring it as const now.
200 226 : inline void SetIdle( bool b ) const
201 226 : { bIdle = b; }
202 :
203 862 : inline bool IsTab(bool bHard = false) const
204 1724 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) &&
205 1706 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
206 1722 : ? sal_True : sal_False; }
207 178 : inline void SetTab( bool b ) {
208 178 : b ? (nCoreOptions |= VIEWOPT_1_TAB ) : ( nCoreOptions &= ~VIEWOPT_1_TAB); }
209 :
210 43379 : inline bool IsBlank(bool bHard = false) const
211 86751 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_BLANK) &&
212 86726 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
213 86749 : ? sal_True : sal_False; }
214 182 : inline void SetBlank( bool b )
215 182 : { b ? (nCoreOptions |= VIEWOPT_1_BLANK ) : ( nCoreOptions &= ~VIEWOPT_1_BLANK); }
216 :
217 72 : inline bool IsHardBlank() const
218 72 : { return !bReadonly && nCoreOptions & VIEWOPT_1_HARDBLANK ? sal_True : sal_False; }
219 182 : inline void SetHardBlank( bool b )
220 182 : { b ? (nCoreOptions |= VIEWOPT_1_HARDBLANK ) : ( nCoreOptions &= ~VIEWOPT_1_HARDBLANK); }
221 :
222 206068 : inline bool IsParagraph(bool bHard = false) const
223 412120 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_PARAGRAPH) &&
224 411996 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
225 412133 : ? sal_True : sal_False; }
226 182 : inline void SetParagraph( bool b )
227 182 : { b ? (nCoreOptions |= VIEWOPT_1_PARAGRAPH ) : ( nCoreOptions &= ~VIEWOPT_1_PARAGRAPH); }
228 :
229 136581 : inline bool IsLineBreak(bool bHard = false) const
230 273160 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_LINEBREAK) &&
231 273140 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
232 273158 : ? sal_True : sal_False; }
233 182 : inline void SetLineBreak( bool b )
234 182 : { b ? (nCoreOptions |= VIEWOPT_1_LINEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_LINEBREAK); }
235 :
236 0 : inline void SetPageBreak( bool b )
237 0 : { b ? (nCoreOptions |= VIEWOPT_1_PAGEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBREAK); }
238 :
239 0 : inline void SetColumnBreak( bool b)
240 0 : { b ? (nCoreOptions |= VIEWOPT_1_COLUMNBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_COLUMNBREAK); }
241 :
242 24 : inline bool IsSoftHyph() const
243 24 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_SOFTHYPH) ? sal_True : sal_False; }
244 182 : inline void SetSoftHyph( bool b )
245 182 : { b ? (nCoreOptions |= VIEWOPT_1_SOFTHYPH ) : ( nCoreOptions &= ~VIEWOPT_1_SOFTHYPH); }
246 :
247 8584 : inline bool IsFldName() const { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLDNAME) ? sal_True : sal_False; }
248 182 : inline void SetFldName( bool b )
249 182 : { b ? (nCoreOptions |= VIEWOPT_1_FLDNAME ) : ( nCoreOptions &= ~VIEWOPT_1_FLDNAME); }
250 :
251 111737 : inline bool IsPostIts() const
252 111737 : { return (nCoreOptions & VIEWOPT_1_POSTITS) ? sal_True : sal_False; }
253 182 : inline void SetPostIts( bool b )
254 182 : { b ? (nCoreOptions |= VIEWOPT_1_POSTITS ) : ( nCoreOptions &= ~VIEWOPT_1_POSTITS); }
255 : void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
256 : bool bIsScript ) const;
257 : sal_uInt16 GetPostItsWidth( const OutputDevice *pOut = 0 ) const;
258 :
259 567984 : inline bool IsShowHiddenChar(bool bHard = false) const
260 1135960 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_CHAR_HIDDEN) &&
261 102 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
262 568148 : ? sal_True : sal_False; }
263 :
264 176 : inline void SetShowHiddenChar( bool b )
265 176 : { b ? (nCoreOptions |= VIEWOPT_1_CHAR_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_CHAR_HIDDEN); }
266 :
267 8802 : inline bool IsShowHiddenField() const
268 8802 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLD_HIDDEN) ? sal_True : sal_False; }
269 178 : inline void SetShowHiddenField( bool b )
270 178 : { b ? (nCoreOptions |= VIEWOPT_1_FLD_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_FLD_HIDDEN); }
271 :
272 3671 : inline bool IsGraphic() const
273 3671 : { return nCoreOptions & VIEWOPT_1_GRAPHIC ? sal_True : sal_False; }
274 792 : inline void SetGraphic( bool b )
275 792 : { b ? (nCoreOptions |= VIEWOPT_1_GRAPHIC ) : ( nCoreOptions &= ~VIEWOPT_1_GRAPHIC); }
276 :
277 69003 : inline bool IsPageBack() const
278 69003 : { return nCoreOptions & VIEWOPT_1_PAGEBACK ? sal_True : sal_False; }
279 610 : inline void SetPageBack( bool b )
280 610 : { b ? (nCoreOptions |= VIEWOPT_1_PAGEBACK) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBACK); }
281 :
282 11185 : inline bool IsTable() const
283 11185 : { return nCoreOptions & VIEWOPT_1_TABLE ? sal_True : sal_False; }
284 792 : inline void SetTable( bool b )
285 792 : { b ? (nCoreOptions |= VIEWOPT_1_TABLE ) : ( nCoreOptions &= ~VIEWOPT_1_TABLE); }
286 :
287 14 : inline bool IsDraw() const
288 14 : { return nCoreOptions & VIEWOPT_1_DRAW ? sal_True : sal_False; }
289 792 : inline void SetDraw( bool b )
290 792 : { b ? (nCoreOptions |= VIEWOPT_1_DRAW ) : ( nCoreOptions &= ~VIEWOPT_1_DRAW); }
291 :
292 0 : inline bool IsControl() const
293 0 : { return nCoreOptions & VIEWOPT_1_CONTROL ? sal_True : sal_False; }
294 610 : inline void SetControl( bool b )
295 610 : { b ? (nCoreOptions |= VIEWOPT_1_CONTROL ) : ( nCoreOptions &= ~VIEWOPT_1_CONTROL); }
296 :
297 7064 : inline bool IsSnap() const
298 7064 : { return nCoreOptions & VIEWOPT_1_SNAP ? sal_True : sal_False; }
299 92 : inline void SetSnap( bool b )
300 92 : { b ? (nCoreOptions |= VIEWOPT_1_SNAP ) : ( nCoreOptions &= ~VIEWOPT_1_SNAP); }
301 :
302 96 : inline void SetSnapSize( Size &rSz ){ aSnapSize = rSz; }
303 7166 : inline const Size &GetSnapSize() const { return aSnapSize; }
304 :
305 12382 : inline bool IsGridVisible() const
306 12382 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_GRIDVISIBLE) ? sal_True : sal_False; }
307 92 : inline void SetGridVisible( bool b )
308 92 : { b ? (nCoreOptions |= VIEWOPT_1_GRIDVISIBLE ) : ( nCoreOptions &= ~VIEWOPT_1_GRIDVISIBLE); }
309 :
310 20376 : inline bool IsOnlineSpell() const
311 20376 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_ONLINESPELL) ? sal_True : sal_False; }
312 4708 : inline void SetOnlineSpell( bool b )
313 4708 : { b ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); }
314 :
315 13234 : inline bool IsViewMetaChars() const
316 13234 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) ? sal_True : sal_False; }
317 180 : inline void SetViewMetaChars( bool b)
318 180 : { b ? (nCoreOptions |= VIEWOPT_1_VIEWMETACHARS ) : ( nCoreOptions &= ~VIEWOPT_1_VIEWMETACHARS); }
319 :
320 0 : inline bool IsSynchronize() const
321 0 : { return nCoreOptions & VIEWOPT_1_SYNCHRONIZE ? sal_True : sal_False;}
322 88 : inline void SetSynchronize( bool b )
323 88 : { b ? (nCoreOptions |= VIEWOPT_1_SYNCHRONIZE ) : ( nCoreOptions &= ~VIEWOPT_1_SYNCHRONIZE); }
324 :
325 7136 : inline bool IsCrossHair() const
326 7136 : { return nCoreOptions & VIEWOPT_1_CROSSHAIR ? sal_True : sal_False; }
327 88 : inline void SetCrossHair( bool b )
328 88 : { b ? (nCoreOptions |= VIEWOPT_1_CROSSHAIR ) : ( nCoreOptions &= ~VIEWOPT_1_CROSSHAIR); }
329 :
330 : // Options from nCore2Options
331 468 : inline bool IsBlackFont() const
332 468 : {return nCore2Options & VIEWOPT_CORE2_BLACKFONT ? sal_True : sal_False;}
333 :
334 610 : inline void SetBlackFont(bool b)
335 610 : { b ? (nCore2Options |= VIEWOPT_CORE2_BLACKFONT) : (nCore2Options &= ~VIEWOPT_CORE2_BLACKFONT);}
336 :
337 3488 : inline bool IsShowHiddenPara() const
338 3488 : {return nCore2Options & VIEWOPT_CORE2_HIDDENPARA ? sal_True : sal_False;}
339 :
340 178 : inline void SetShowHiddenPara(bool b)
341 178 : { b ? (nCore2Options |= VIEWOPT_CORE2_HIDDENPARA) : (nCore2Options &= ~VIEWOPT_CORE2_HIDDENPARA);}
342 :
343 458 : inline bool IsSmoothScroll() const
344 458 : {return nCore2Options & VIEWOPT_CORE2_SMOOTHSCROLL ? sal_True : sal_False;}
345 :
346 94 : inline void SetSmoothScroll(bool b)
347 94 : { b ? (nCore2Options |= VIEWOPT_CORE2_SMOOTHSCROLL) : (nCore2Options &= ~VIEWOPT_CORE2_SMOOTHSCROLL);}
348 :
349 4844 : inline bool IsCursorInProtectedArea() const
350 4844 : {return nCore2Options & VIEWOPT_CORE2_CRSR_IN_PROT ? sal_True : sal_False;}
351 :
352 88 : inline void SetCursorInProtectedArea(bool b)
353 88 : { b ? (nCore2Options |= VIEWOPT_CORE2_CRSR_IN_PROT) : (nCore2Options &= ~VIEWOPT_CORE2_CRSR_IN_PROT);}
354 :
355 38188 : inline bool IsPDFExport() const
356 38188 : {return nCore2Options & VIEWOPT_CORE2_PDF_EXPORT ? sal_True : sal_False;}
357 :
358 0 : inline void SetPDFExport(bool b)
359 0 : { b ? (nCore2Options |= VIEWOPT_CORE2_PDF_EXPORT) : (nCore2Options &= ~VIEWOPT_CORE2_PDF_EXPORT);}
360 :
361 0 : inline bool IsPrinting() const
362 0 : {return nCore2Options & VIEWOPT_CORE2_PRINTING ? sal_True : sal_False;}
363 :
364 0 : inline void SetPrinting(bool b)
365 0 : { b ? (nCore2Options |= VIEWOPT_CORE2_PRINTING) : (nCore2Options &= ~VIEWOPT_CORE2_PRINTING);}
366 :
367 15794 : inline short GetDivisionX() const { return nDivisionX; }
368 92 : inline void SetDivisionX( short n ){ nDivisionX = n; }
369 15786 : inline short GetDivisionY() const { return nDivisionY; }
370 92 : inline void SetDivisionY( short n ){ nDivisionY = n; }
371 :
372 1668 : inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
373 0 : inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
374 1668 : inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
375 0 : inline void SetPagePrevCol( sal_uInt8 n ) { nPagePrevCol = n; }
376 358655 : bool IsReadonly() const { return bReadonly; }
377 6472 : void SetReadonly(bool bSet) { bReadonly = bSet; }
378 :
379 69 : bool IsSelectionInReadonly() const {return bSelectionInReadonly;}
380 4708 : void SetSelectionInReadonly(bool bSet) {bSelectionInReadonly = bSet;}
381 :
382 314991 : bool IsFormView() const { return mbFormView; }
383 0 : void SetFormView( bool bSet ) { mbFormView = bSet; }
384 :
385 6878750 : inline bool getBrowseMode() const { return mbBrowseMode; }
386 4712 : inline void setBrowseMode(bool bSet) { mbBrowseMode = bSet; }
387 0 : inline bool IsPagePrevBookview() const { return mbBookView; }
388 0 : inline void SetPagePrevBookview(bool bSet) { mbBookView = bSet; }
389 :
390 : bool IsAutoCompleteWords() const;
391 :
392 474974 : bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
393 144 : void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
394 83527 : sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
395 144 : void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
396 :
397 : #ifdef DBG_UTIL
398 : // Correspond to statements in ui/config/cfgvw.src.
399 : inline bool IsTest1() const { return m_bTest1; }
400 : inline void SetTest1( bool b ) { m_bTest1 = b; }
401 : inline bool IsTest2() const { return m_bTest2; }
402 : inline void SetTest2( bool b ) { m_bTest2 = b; }
403 : inline bool IsTest3() const { return m_bTest3; }
404 : inline void SetTest3( bool b ) { m_bTest3 = b; }
405 : inline bool IsTest4() const { return m_bTest4; }
406 : inline void SetTest4( bool b ) { m_bTest4 = b; }
407 : inline bool IsTest5() const { return m_bTest5; }
408 : inline void SetTest5( bool b ) { m_bTest5 = b; }
409 : inline bool IsTest6() const { return m_bTest6; }
410 : inline void SetTest6( bool b ) { m_bTest6 = b; }
411 : inline bool IsTest7() const { return m_bTest7; }
412 : inline void SetTest7( bool b ) { m_bTest7 = b; }
413 : inline bool IsTest8() const { return m_bTest8; }
414 : inline void SetTest8( bool b ) { m_bTest8 = b; }
415 : static inline bool IsTest9() { return s_bTest9; }
416 : static inline void SetTest9( bool b ) { s_bTest9 = b; }
417 : inline bool IsTest10() const { return m_bTest10; }
418 : inline void SetTest10( bool b ) { m_bTest10 = b; }
419 : #endif
420 :
421 1136180 : inline sal_uInt16 GetZoom() const { return nZoom; }
422 1652 : inline void SetZoom( sal_uInt16 n ){ nZoom = n; }
423 :
424 : void DrawRect( OutputDevice* pOut, const SwRect &rRect, long nCol ) const;
425 : void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect ) const;
426 :
427 : SwViewOption& operator=( const SwViewOption &rOpt );
428 :
429 : // Compare methods.
430 : bool IsEqualFlags ( const SwViewOption &rOpt ) const;
431 : inline bool operator == ( const SwViewOption &rOpt ) const;
432 0 : inline bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); }
433 :
434 : // Options from nUIOptions
435 28342 : bool IsViewVScrollBar() const
436 : {
437 : #if HAVE_FEATURE_DESKTOP
438 28342 : return nUIOptions & VIEWOPT_2_VSCROLLBAR ? sal_True : sal_False;
439 : #else
440 : return sal_False;
441 : #endif
442 : }
443 28342 : bool IsViewHScrollBar() const
444 : {
445 : #if HAVE_FEATURE_DESKTOP
446 28342 : return nUIOptions & VIEWOPT_2_HSCROLLBAR ? sal_True : sal_False;
447 : #else
448 : return sal_False;
449 : #endif
450 : }
451 0 : bool IsKeepRatio() const
452 0 : { return nUIOptions & VIEWOPT_2_KEEPASPECTRATIO ? sal_True : sal_False; }
453 0 : bool IsGrfKeepZoom() const
454 0 : { return nUIOptions & VIEWOPT_2_GRFKEEPZOOM ? sal_True : sal_False; }
455 10 : bool IsShowContentTips() const
456 10 : { return nUIOptions & VIEWOPT_2_CONTENT_TIPS ? sal_True : sal_False; }
457 2404 : bool IsPrtFormat() const
458 2404 : { return nUIOptions & VIEWOPT_2_PRTFORMAT ? sal_True : sal_False; }
459 94 : bool IsShowScrollBarTips() const
460 94 : { return nUIOptions & VIEWOPT_2_SCROLLBAR_TIPS ? sal_True : sal_False; }
461 :
462 115191 : SvxZoomType GetZoomType() const { return eZoom; }
463 :
464 0 : sal_uInt8 GetTblDest() const { return nTblDest; }
465 :
466 94 : void SetViewVScrollBar(bool b)
467 94 : { b ? (nUIOptions |= VIEWOPT_2_VSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_VSCROLLBAR); }
468 94 : void SetViewHScrollBar(bool b)
469 94 : { b ? (nUIOptions |= VIEWOPT_2_HSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_HSCROLLBAR); }
470 0 : void SetKeepRatio (bool b)
471 0 : { b ? (nUIOptions |= VIEWOPT_2_KEEPASPECTRATIO ) : ( nUIOptions &= ~VIEWOPT_2_KEEPASPECTRATIO); }
472 0 : void SetGrfKeepZoom (bool b)
473 0 : { b ? (nUIOptions |= VIEWOPT_2_GRFKEEPZOOM ) : ( nUIOptions &= ~VIEWOPT_2_GRFKEEPZOOM); }
474 176 : void SetShowContentTips( bool b)
475 176 : { b ? (nUIOptions |= VIEWOPT_2_CONTENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_CONTENT_TIPS); }
476 610 : void SetPrtFormat( bool b)
477 610 : { b ? (nUIOptions |= VIEWOPT_2_PRTFORMAT) : (nUIOptions &= ~VIEWOPT_2_PRTFORMAT); }
478 90 : void SetShowScrollBarTips( bool b)
479 90 : { b ? (nUIOptions |= VIEWOPT_2_SCROLLBAR_TIPS) : (nUIOptions &= ~VIEWOPT_2_SCROLLBAR_TIPS); }
480 :
481 3190 : void SetZoomType (SvxZoomType eZoom_){ eZoom = eZoom_; }
482 0 : void SetTblDest( sal_uInt8 nNew ) { nTblDest = nNew; }
483 :
484 4934 : const OUString& GetSymbolFont() const {return sSymbolFont;}
485 4934 : void SetSymbolFont(const OUString& sSet) {sSymbolFont = sSet;}
486 :
487 15539 : const Color& GetRetoucheColor() const { return aRetoucheColor;}
488 0 : void SetRetoucheColor(const Color&r) { aRetoucheColor = r; }
489 :
490 110 : bool IsViewAnyRuler() const
491 : {
492 : #if HAVE_FEATURE_DESKTOP
493 110 : return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);
494 : #else
495 : return sal_False;
496 : #endif
497 : }
498 94 : void SetViewAnyRuler(bool bSet)
499 94 : { bSet ? (nUIOptions |= VIEWOPT_2_ANY_RULER) : (nUIOptions &= ~VIEWOPT_2_ANY_RULER);}
500 :
501 9686 : bool IsViewHRuler(bool bDirect = false) const
502 : {
503 : #if HAVE_FEATURE_DESKTOP
504 : bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
505 110 : 0 != (nUIOptions & VIEWOPT_2_H_RULER) :
506 9576 : !bReadonly ?
507 9572 : (nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)
508 28944 : : sal_False );
509 9686 : return bRet;
510 : #else
511 : (void) bDirect;
512 : return sal_False;
513 : #endif
514 : }
515 94 : void SetViewHRuler (bool b)
516 94 : { b ? (nUIOptions |= VIEWOPT_2_H_RULER ) : ( nUIOptions &= ~VIEWOPT_2_H_RULER);}
517 :
518 5034 : bool IsViewVRuler(bool bDirect = false) const
519 : {
520 : #if HAVE_FEATURE_DESKTOP
521 : bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
522 100 : 0 !=(nUIOptions & VIEWOPT_2_V_RULER) :
523 4934 : !bReadonly ?
524 4932 : (nUIOptions &
525 : (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)
526 15000 : : sal_False );
527 5034 : return bRet;
528 : #else
529 : (void) bDirect;
530 : return sal_False;
531 : #endif
532 : }
533 94 : void SetViewVRuler (bool b)
534 94 : { b ? (nUIOptions |= VIEWOPT_2_V_RULER ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER);}
535 :
536 : // ShadowCursor, switch on/off, get/set color/mode.
537 0 : bool IsShadowCursor() const
538 0 : { return nUIOptions & VIEWOPT_2_SHADOWCRSR ? sal_True : sal_False; }
539 88 : void SetShadowCursor(bool b)
540 88 : { b ? (nUIOptions |= VIEWOPT_2_SHADOWCRSR ) : ( nUIOptions &= ~VIEWOPT_2_SHADOWCRSR); }
541 :
542 : //move vertical ruler to the right
543 46774 : bool IsVRulerRight() const
544 46774 : { return nUIOptions & VIEWOPT_2_V_RULER_RIGHT ? sal_True : sal_False; }
545 92 : void SetVRulerRight(bool b)
546 92 : { b ? (nUIOptions |= VIEWOPT_2_V_RULER_RIGHT ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER_RIGHT); }
547 :
548 4946 : bool IsStarOneSetting() const {return bStarOneSetting; }
549 454 : void SetStarOneSetting(bool bSet) {bStarOneSetting = bSet; }
550 :
551 114106 : bool IsPagePreview() const {return bIsPagePreview; }
552 0 : void SetPagePreview(bool bSet) { bIsPagePreview= bSet; }
553 :
554 0 : sal_uInt8 GetShdwCrsrFillMode() const { return nShdwCrsrFillMode; }
555 88 : void SetShdwCrsrFillMode( sal_uInt8 nMode ) { nShdwCrsrFillMode = nMode; };
556 :
557 0 : bool IsShowPlaceHolderFields() const { return bShowPlaceHolderFields; }
558 0 : void SetShowPlaceHolderFields(bool bSet) { bShowPlaceHolderFields = bSet; }
559 :
560 : static Color& GetDocColor();
561 : static Color& GetDocBoundariesColor();
562 : static Color& GetAppBackgroundColor();
563 : static Color& GetObjectBoundariesColor();
564 : static Color& GetTableBoundariesColor();
565 : static Color& GetIndexShadingsColor();
566 : static Color& GetLinksColor();
567 : static Color& GetVisitedLinksColor();
568 : static Color& GetDirectCursorColor();
569 : static Color& GetTextGridColor();
570 : static Color& GetSpellColor();
571 : static Color& GetSmarttagColor();
572 : static Color& GetShadowColor();
573 : SW_DLLPUBLIC static Color& GetFontColor();
574 : static Color& GetFieldShadingsColor();
575 : static Color& GetSectionBoundColor();
576 : static Color& GetPageBreakColor();
577 : static Color& GetHeaderFooterMarkColor();
578 :
579 : static bool IsAppearanceFlag(sal_Int32 nFlag);
580 :
581 48545 : static bool IsDocBoundaries() {return IsAppearanceFlag(VIEWOPT_DOC_BOUNDARIES);}
582 0 : static bool IsObjectBoundaries(){return IsAppearanceFlag(VIEWOPT_OBJECT_BOUNDARIES);}
583 964 : static bool IsTableBoundaries() {return IsAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES );}
584 892 : static bool IsIndexShadings() {return IsAppearanceFlag(VIEWOPT_INDEX_SHADINGS );}
585 3746 : static bool IsLinks() {return IsAppearanceFlag(VIEWOPT_LINKS );}
586 0 : static bool IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS );}
587 6388 : static bool IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS);}
588 0 : static bool IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES);}
589 12100 : static bool IsShadow() {return IsAppearanceFlag(VIEWOPT_SHADOW );}
590 :
591 : static void SetAppearanceFlag(sal_Int32 nFlag, bool bSet, bool bSaveInConfig = false);
592 :
593 6 : void SetDocBoundaries(bool bSet) {SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bSet);}
594 :
595 : static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
596 : };
597 :
598 1958 : inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
599 : {
600 1958 : return IsEqualFlags( rOpt ) && nZoom == rOpt.GetZoom();
601 : }
602 :
603 6666 : inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
604 : {
605 6666 : nUIOptions = rVOpt.nUIOptions;
606 6666 : nTblDest = rVOpt.nTblDest;
607 6666 : nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
608 6666 : }
609 :
610 : // Helper function for checking HTML-capabilities.
611 : SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*);
612 :
613 : #endif
614 :
615 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|