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