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