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