Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / viewopt.hxx
blob64c1e269f2f6f7b55daae1dd68d661bc378b6b2f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_INC_VIEWOPT_HXX
21 #define INCLUDED_SW_INC_VIEWOPT_HXX
23 #include <config_features.h>
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
28 #include <sfx2/zoomitem.hxx>
29 #include <svx/svxids.hrc>
30 #include "swdllapi.h"
31 #include "authratr.hxx"
33 class SwRect;
34 namespace vcl { class Window; }
35 class OutputDevice;
36 class SwViewShell;
37 class SwDocShell;
38 namespace svtools{ class ColorConfig;}
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
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_VIEWMETACHARS 0x20000000L
64 #define VIEWOPT_1_PAGEBACK 0x40000000L
66 #define VIEWOPT_CORE2_BLACKFONT 0x00000001L
67 #define VIEWOPT_CORE2_HIDDENPARA 0x00000002L
68 #define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L
69 #define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L
70 #define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L
71 #define VIEWOPT_CORE2_PRINTING 0x00000020L
72 #define VIEWOPT_CORE2_IGNORE_PROT 0x00000040L
74 #define VIEWOPT_2_H_RULER 0x00000400L
75 #define VIEWOPT_2_VSCROLLBAR 0x00000800L
76 #define VIEWOPT_2_HSCROLLBAR 0x00001000L
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_CONTENT_TIPS 0x00100000L
83 #define VIEWOPT_2_SCROLLBAR_TIPS 0x00400000L
84 #define VIEWOPT_2_PRTFORMAT 0x00800000L
85 #define VIEWOPT_2_SHADOWCRSR 0x01000000L
86 #define VIEWOPT_2_V_RULER_RIGHT 0x02000000L
88 // Table background.
89 #define TBL_DEST_CELL 0
90 #define TBL_DEST_ROW 1
91 #define TBL_DEST_TBL 2
93 // Appearance flags.
94 #define VIEWOPT_DOC_BOUNDARIES 0x0001
95 #define VIEWOPT_OBJECT_BOUNDARIES 0x0002
96 #define VIEWOPT_TABLE_BOUNDARIES 0x0004
97 #define VIEWOPT_INDEX_SHADINGS 0x0008
98 #define VIEWOPT_LINKS 0x0010
99 #define VIEWOPT_VISITED_LINKS 0x0020
100 #define VIEWOPT_FIELD_SHADINGS 0x0040
101 #define VIEWOPT_SECTION_BOUNDARIES 0x0080
102 #define VIEWOPT_SHADOW 0x0100
104 // Implementation in core/text/txtpaint.cxx.
105 extern void SyncVout( const OutputDevice *pOut );
107 class SW_DLLPUBLIC SwViewOption
109 static Color aDocColor; // color of document boundaries
110 static Color aDocBoundColor; // color of document boundaries
111 static Color aObjectBoundColor; // color of object boundaries
112 static Color aAppBackgroundColor; // application background
113 static Color aTableBoundColor; // color of table boundaries
114 static Color aFontColor;
115 static Color aIndexShadingsColor; // background color of indexes
116 static Color aLinksColor;
117 static Color aVisitedLinksColor;
118 static Color aDirectCursorColor;
119 static Color aTextGridColor;
120 static Color aSpellColor; // mark color of online spell checking
121 static Color aSmarttagColor;
122 static Color aFieldShadingsColor;
123 static Color aSectionBoundColor;
124 static Color aPageBreakColor;
125 static Color aScriptIndicatorColor;
126 static Color aShadowColor;
127 static Color aHeaderFooterMarkColor;
129 static sal_Int32 nAppearanceFlags;
130 protected:
131 static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
133 OUString sSymbolFont; // Symbolfont.
134 sal_uInt32 nCoreOptions; // Bits for SwViewShell.
135 sal_uInt32 nCore2Options; // Bits for SwViewShell.
136 sal_uInt32 nUIOptions; // UI-Bits
137 Color aRetoucheColor; // DefaultBackground for BrowseView
138 Size aSnapSize; // Describes horizontal and vertical snap.
139 sal_uInt16 mnViewLayoutColumns;// # columns for edit view
140 short nDivisionX; // Grid division.
141 short nDivisionY;
142 sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
143 sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
144 sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
145 bool bReadonly : 1; // Readonly-Doc.
146 bool bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
147 bool bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
148 bool bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents.
149 bool mbFormView : 1;
150 bool mbBrowseMode : 1;
151 bool mbBookView : 1; // View mode for page preview.
152 bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
153 bool bShowPlaceHolderFields : 1; // Only used in printing!
154 mutable bool bIdle;
156 // Scale
157 sal_uInt16 nZoom; // In percent.
158 SvxZoomType eZoom; // 'enum' for zoom.
160 sal_uInt8 nTableDest; // Destination for table background.
162 #ifdef DBG_UTIL
163 // Corresponds to statements in ui/config/cfgvw.src.
164 bool m_bTest1 :1; // Test-flag "Layout not loading"
165 bool m_bTest2 :1; // Test-flag "WYSIWYG++"
166 bool m_bTest3 :1; // Test-flag ""
167 bool m_bTest4 :1; // Test-flag "WYSIWYG debug"
168 bool m_bTest5 :1; // Test-flag "No idle format"
169 bool m_bTest6 :1; // Test-flag "No screen adj"
170 bool m_bTest7 :1; // Test-flag "win format"
171 bool m_bTest8 :1; // Test-flag ""
172 static bool s_bTest9; // Test-Flag "DrawingLayerNotLoading"
173 bool m_bTest10 :1; // Test-Flag "Format by Input"
174 #endif
176 public:
177 SwViewOption(); // CTOR
178 SwViewOption(const SwViewOption&);
179 ~SwViewOption();
181 static void Init( vcl::Window *pWin ); // Initializing of static data.
183 static sal_uInt16 GetPixelTwips() { return nPixelTwips; }
185 inline sal_uInt32 GetCoreOptions() const {return nCoreOptions;}
186 inline void SetUIOptions( const SwViewOption& );
188 // Options from nCoreOptions
189 inline bool IsIdle() const
190 { return bIdle; }
192 // Logically this is a const function since it does not modify the viewoptions
193 // but only effects idle formatting. Of course that member is already implement
194 // in the wrong place here... Also currently there are many const modifying casts in the code
195 // just to call this function on otherwise const objects. Thus declaring it as const now.
196 inline void SetIdle( bool b ) const
197 { bIdle = b; }
199 inline bool IsTab(bool bHard = false) const
200 { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) &&
201 ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard); }
202 inline void SetTab( bool b ) {
203 b ? (nCoreOptions |= VIEWOPT_1_TAB ) : ( nCoreOptions &= ~VIEWOPT_1_TAB); }
205 inline bool IsBlank(bool bHard = false) const
206 { return !bReadonly && (nCoreOptions & VIEWOPT_1_BLANK) &&
207 ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard); }
208 inline void SetBlank( bool b )
209 { b ? (nCoreOptions |= VIEWOPT_1_BLANK ) : ( nCoreOptions &= ~VIEWOPT_1_BLANK); }
211 inline bool IsHardBlank() const
212 { return !bReadonly && (nCoreOptions & VIEWOPT_1_HARDBLANK) != 0; }
213 inline void SetHardBlank( bool b )
214 { b ? (nCoreOptions |= VIEWOPT_1_HARDBLANK ) : ( nCoreOptions &= ~VIEWOPT_1_HARDBLANK); }
216 inline bool IsParagraph(bool bHard = false) const
217 { return !bReadonly && (nCoreOptions & VIEWOPT_1_PARAGRAPH) &&
218 ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard); }
219 inline void SetParagraph( bool b )
220 { b ? (nCoreOptions |= VIEWOPT_1_PARAGRAPH ) : ( nCoreOptions &= ~VIEWOPT_1_PARAGRAPH); }
222 inline bool IsLineBreak(bool bHard = false) const
223 { return !bReadonly && (nCoreOptions & VIEWOPT_1_LINEBREAK) &&
224 ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard); }
225 inline void SetLineBreak( bool b )
226 { b ? (nCoreOptions |= VIEWOPT_1_LINEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_LINEBREAK); }
228 inline void SetPageBreak( bool b )
229 { b ? (nCoreOptions |= VIEWOPT_1_PAGEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBREAK); }
231 inline void SetColumnBreak( bool b)
232 { b ? (nCoreOptions |= VIEWOPT_1_COLUMNBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_COLUMNBREAK); }
234 inline bool IsSoftHyph() const
235 { return !bReadonly && (nCoreOptions & VIEWOPT_1_SOFTHYPH) != 0; }
236 inline void SetSoftHyph( bool b )
237 { b ? (nCoreOptions |= VIEWOPT_1_SOFTHYPH ) : ( nCoreOptions &= ~VIEWOPT_1_SOFTHYPH); }
239 inline bool IsFieldName() const { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLDNAME) != 0; }
240 inline void SetFieldName( bool b )
241 { b ? (nCoreOptions |= VIEWOPT_1_FLDNAME ) : ( nCoreOptions &= ~VIEWOPT_1_FLDNAME); }
243 inline bool IsPostIts() const
244 { return (nCoreOptions & VIEWOPT_1_POSTITS) != 0; }
245 inline void SetPostIts( bool b )
246 { b ? (nCoreOptions |= VIEWOPT_1_POSTITS ) : ( nCoreOptions &= ~VIEWOPT_1_POSTITS); }
247 static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
248 bool bIsScript );
249 static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut = 0 );
251 inline bool IsShowHiddenChar(bool bHard = false) const
252 { return !bReadonly && (nCoreOptions & VIEWOPT_1_CHAR_HIDDEN) &&
253 ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard); }
255 inline void SetShowHiddenChar( bool b )
256 { b ? (nCoreOptions |= VIEWOPT_1_CHAR_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_CHAR_HIDDEN); }
258 inline bool IsShowHiddenField() const
259 { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLD_HIDDEN) != 0; }
260 inline void SetShowHiddenField( bool b )
261 { b ? (nCoreOptions |= VIEWOPT_1_FLD_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_FLD_HIDDEN); }
263 inline bool IsGraphic() const
264 { return (nCoreOptions & VIEWOPT_1_GRAPHIC) != 0; }
265 inline void SetGraphic( bool b )
266 { b ? (nCoreOptions |= VIEWOPT_1_GRAPHIC ) : ( nCoreOptions &= ~VIEWOPT_1_GRAPHIC); }
268 inline bool IsPageBack() const
269 { return (nCoreOptions & VIEWOPT_1_PAGEBACK) != 0; }
270 inline void SetPageBack( bool b )
271 { b ? (nCoreOptions |= VIEWOPT_1_PAGEBACK) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBACK); }
273 inline bool IsTable() const
274 { return (nCoreOptions & VIEWOPT_1_TABLE) != 0; }
275 inline void SetTable( bool b )
276 { b ? (nCoreOptions |= VIEWOPT_1_TABLE ) : ( nCoreOptions &= ~VIEWOPT_1_TABLE); }
278 inline bool IsDraw() const
279 { return (nCoreOptions & VIEWOPT_1_DRAW) != 0; }
280 inline void SetDraw( bool b )
281 { b ? (nCoreOptions |= VIEWOPT_1_DRAW ) : ( nCoreOptions &= ~VIEWOPT_1_DRAW); }
283 inline bool IsControl() const
284 { return (nCoreOptions & VIEWOPT_1_CONTROL) != 0; }
285 inline void SetControl( bool b )
286 { b ? (nCoreOptions |= VIEWOPT_1_CONTROL ) : ( nCoreOptions &= ~VIEWOPT_1_CONTROL); }
288 inline bool IsSnap() const
289 { return (nCoreOptions & VIEWOPT_1_SNAP) != 0; }
290 inline void SetSnap( bool b )
291 { b ? (nCoreOptions |= VIEWOPT_1_SNAP ) : ( nCoreOptions &= ~VIEWOPT_1_SNAP); }
293 inline void SetSnapSize( Size &rSz ){ aSnapSize = rSz; }
294 inline const Size &GetSnapSize() const { return aSnapSize; }
296 inline bool IsGridVisible() const
297 { return !bReadonly && (nCoreOptions & VIEWOPT_1_GRIDVISIBLE) != 0; }
298 inline void SetGridVisible( bool b )
299 { b ? (nCoreOptions |= VIEWOPT_1_GRIDVISIBLE ) : ( nCoreOptions &= ~VIEWOPT_1_GRIDVISIBLE); }
301 inline bool IsOnlineSpell() const
302 { return !bReadonly && (nCoreOptions & VIEWOPT_1_ONLINESPELL) != 0; }
303 inline void SetOnlineSpell( bool b )
304 { b ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); }
306 inline bool IsViewMetaChars() const
307 { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) != 0; }
308 inline void SetViewMetaChars( bool b)
309 { b ? (nCoreOptions |= VIEWOPT_1_VIEWMETACHARS ) : ( nCoreOptions &= ~VIEWOPT_1_VIEWMETACHARS); }
311 inline bool IsSynchronize() const
312 { return (nCoreOptions & VIEWOPT_1_SYNCHRONIZE) != 0; }
313 inline void SetSynchronize( bool b )
314 { b ? (nCoreOptions |= VIEWOPT_1_SYNCHRONIZE ) : ( nCoreOptions &= ~VIEWOPT_1_SYNCHRONIZE); }
316 inline bool IsCrossHair() const
317 { return (nCoreOptions & VIEWOPT_1_CROSSHAIR) != 0; }
318 inline void SetCrossHair( bool b )
319 { b ? (nCoreOptions |= VIEWOPT_1_CROSSHAIR ) : ( nCoreOptions &= ~VIEWOPT_1_CROSSHAIR); }
321 // Options from nCore2Options
322 inline bool IsBlackFont() const
323 {return (nCore2Options & VIEWOPT_CORE2_BLACKFONT) != 0; }
325 inline void SetBlackFont(bool b)
326 { b ? (nCore2Options |= VIEWOPT_CORE2_BLACKFONT) : (nCore2Options &= ~VIEWOPT_CORE2_BLACKFONT);}
328 inline bool IsShowHiddenPara() const
329 {return (nCore2Options & VIEWOPT_CORE2_HIDDENPARA) != 0; }
331 inline void SetShowHiddenPara(bool b)
332 { b ? (nCore2Options |= VIEWOPT_CORE2_HIDDENPARA) : (nCore2Options &= ~VIEWOPT_CORE2_HIDDENPARA);}
334 inline bool IsSmoothScroll() const
335 {return (nCore2Options & VIEWOPT_CORE2_SMOOTHSCROLL) != 0; }
337 inline void SetSmoothScroll(bool b)
338 { b ? (nCore2Options |= VIEWOPT_CORE2_SMOOTHSCROLL) : (nCore2Options &= ~VIEWOPT_CORE2_SMOOTHSCROLL);}
340 inline bool IsCursorInProtectedArea() const
341 {return (nCore2Options & VIEWOPT_CORE2_CRSR_IN_PROT) != 0; }
343 inline void SetCursorInProtectedArea(bool b)
344 { b ? (nCore2Options |= VIEWOPT_CORE2_CRSR_IN_PROT) : (nCore2Options &= ~VIEWOPT_CORE2_CRSR_IN_PROT);}
346 bool IsIgnoreProtectedArea() const
348 return (nCore2Options & VIEWOPT_CORE2_IGNORE_PROT) != 0;
351 void SetIgnoreProtectedArea(bool bSet)
353 bSet ? (nCore2Options |= VIEWOPT_CORE2_IGNORE_PROT) : (nCore2Options &= ~VIEWOPT_CORE2_IGNORE_PROT);
356 inline bool IsPDFExport() const
357 {return (nCore2Options & VIEWOPT_CORE2_PDF_EXPORT) != 0; }
359 inline void SetPDFExport(bool b)
360 { b ? (nCore2Options |= VIEWOPT_CORE2_PDF_EXPORT) : (nCore2Options &= ~VIEWOPT_CORE2_PDF_EXPORT);}
362 inline bool IsPrinting() const
363 {return (nCore2Options & VIEWOPT_CORE2_PRINTING) != 0; }
365 inline void SetPrinting(bool b)
366 { b ? (nCore2Options |= VIEWOPT_CORE2_PRINTING) : (nCore2Options &= ~VIEWOPT_CORE2_PRINTING);}
368 inline short GetDivisionX() const { return nDivisionX; }
369 inline void SetDivisionX( short n ){ nDivisionX = n; }
370 inline short GetDivisionY() const { return nDivisionY; }
371 inline void SetDivisionY( short n ){ nDivisionY = n; }
373 inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
374 inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
375 inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
376 inline void SetPagePrevCol( sal_uInt8 n ) { nPagePrevCol = n; }
377 bool IsReadonly() const { return bReadonly; }
378 void SetReadonly(bool bSet) { bReadonly = bSet; }
380 bool IsSelectionInReadonly() const {return bSelectionInReadonly;}
381 void SetSelectionInReadonly(bool bSet) {bSelectionInReadonly = bSet;}
383 bool IsFormView() const { return mbFormView; }
384 void SetFormView( bool bSet ) { mbFormView = bSet; }
386 inline bool getBrowseMode() const { return mbBrowseMode; }
387 inline void setBrowseMode(bool bSet) { mbBrowseMode = bSet; }
388 inline bool IsPagePrevBookview() const { return mbBookView; }
389 inline void SetPagePrevBookview(bool bSet) { mbBookView = bSet; }
391 static bool IsAutoCompleteWords();
393 bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
394 void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
395 sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
396 void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
398 #ifdef DBG_UTIL
399 // Correspond to statements in ui/config/cfgvw.src.
400 inline bool IsTest1() const { return m_bTest1; }
401 inline void SetTest1( bool b ) { m_bTest1 = b; }
402 inline bool IsTest2() const { return m_bTest2; }
403 inline void SetTest2( bool b ) { m_bTest2 = b; }
404 inline bool IsTest3() const { return m_bTest3; }
405 inline void SetTest3( bool b ) { m_bTest3 = b; }
406 inline bool IsTest4() const { return m_bTest4; }
407 inline void SetTest4( bool b ) { m_bTest4 = b; }
408 inline bool IsTest5() const { return m_bTest5; }
409 inline void SetTest5( bool b ) { m_bTest5 = b; }
410 inline bool IsTest6() const { return m_bTest6; }
411 inline void SetTest6( bool b ) { m_bTest6 = b; }
412 inline bool IsTest7() const { return m_bTest7; }
413 inline void SetTest7( bool b ) { m_bTest7 = b; }
414 inline bool IsTest8() const { return m_bTest8; }
415 inline void SetTest8( bool b ) { m_bTest8 = b; }
416 static inline bool IsTest9() { return s_bTest9; }
417 static inline void SetTest9( bool b ) { s_bTest9 = b; }
418 inline bool IsTest10() const { return m_bTest10; }
419 inline void SetTest10( bool b ) { m_bTest10 = b; }
420 #endif
422 inline sal_uInt16 GetZoom() const { return nZoom; }
423 inline void SetZoom( sal_uInt16 n ){ nZoom = n; }
425 static void DrawRect( OutputDevice* pOut, const SwRect &rRect, long nCol );
426 static void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect );
428 SwViewOption& operator=( const SwViewOption &rOpt );
430 // Compare methods.
431 bool IsEqualFlags ( const SwViewOption &rOpt ) const;
432 inline bool operator == ( const SwViewOption &rOpt ) const;
433 inline bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); }
435 // Options from nUIOptions
436 bool IsViewVScrollBar() const
438 #if HAVE_FEATURE_DESKTOP
439 return (nUIOptions & VIEWOPT_2_VSCROLLBAR) != 0;
440 #else
441 return false;
442 #endif
444 bool IsViewHScrollBar() const
446 #if HAVE_FEATURE_DESKTOP
447 return (nUIOptions & VIEWOPT_2_HSCROLLBAR) != 0;
448 #else
449 return false;
450 #endif
452 bool IsKeepRatio() const
453 { return (nUIOptions & VIEWOPT_2_KEEPASPECTRATIO) != 0; }
454 bool IsGrfKeepZoom() const
455 { return (nUIOptions & VIEWOPT_2_GRFKEEPZOOM) != 0; }
456 bool IsShowContentTips() const
457 { return (nUIOptions & VIEWOPT_2_CONTENT_TIPS) != 0; }
458 bool IsPrtFormat() const
459 { return (nUIOptions & VIEWOPT_2_PRTFORMAT) != 0; }
460 bool IsShowScrollBarTips() const
461 { return (nUIOptions & VIEWOPT_2_SCROLLBAR_TIPS) != 0; }
463 SvxZoomType GetZoomType() const { return eZoom; }
465 sal_uInt8 GetTableDest() const { return nTableDest; }
467 void SetViewVScrollBar(bool b)
468 { b ? (nUIOptions |= VIEWOPT_2_VSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_VSCROLLBAR); }
469 void SetViewHScrollBar(bool b)
470 { b ? (nUIOptions |= VIEWOPT_2_HSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_HSCROLLBAR); }
471 void SetKeepRatio (bool b)
472 { b ? (nUIOptions |= VIEWOPT_2_KEEPASPECTRATIO ) : ( nUIOptions &= ~VIEWOPT_2_KEEPASPECTRATIO); }
473 void SetGrfKeepZoom (bool b)
474 { b ? (nUIOptions |= VIEWOPT_2_GRFKEEPZOOM ) : ( nUIOptions &= ~VIEWOPT_2_GRFKEEPZOOM); }
475 void SetShowContentTips( bool b)
476 { b ? (nUIOptions |= VIEWOPT_2_CONTENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_CONTENT_TIPS); }
477 void SetPrtFormat( bool b)
478 { b ? (nUIOptions |= VIEWOPT_2_PRTFORMAT) : (nUIOptions &= ~VIEWOPT_2_PRTFORMAT); }
479 void SetShowScrollBarTips( bool b)
480 { b ? (nUIOptions |= VIEWOPT_2_SCROLLBAR_TIPS) : (nUIOptions &= ~VIEWOPT_2_SCROLLBAR_TIPS); }
482 void SetZoomType (SvxZoomType eZoom_){ eZoom = eZoom_; }
483 void SetTableDest( sal_uInt8 nNew ) { nTableDest = nNew; }
485 const OUString& GetSymbolFont() const {return sSymbolFont;}
486 void SetSymbolFont(const OUString& sSet) {sSymbolFont = sSet;}
488 const Color& GetRetoucheColor() const { return aRetoucheColor;}
489 void SetRetoucheColor(const Color&r) { aRetoucheColor = r; }
491 bool IsViewAnyRuler() const
493 #if HAVE_FEATURE_DESKTOP
494 return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);
495 #else
496 return false;
497 #endif
499 void SetViewAnyRuler(bool bSet)
500 { bSet ? (nUIOptions |= VIEWOPT_2_ANY_RULER) : (nUIOptions &= ~VIEWOPT_2_ANY_RULER);}
502 bool IsViewHRuler(bool bDirect = false) const
504 #if HAVE_FEATURE_DESKTOP
505 return bDirect
506 ? 0 != (nUIOptions & VIEWOPT_2_H_RULER)
507 : !bReadonly && (nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER);
508 #else
509 (void) bDirect;
510 return false;
511 #endif
513 void SetViewHRuler (bool b)
514 { b ? (nUIOptions |= VIEWOPT_2_H_RULER ) : ( nUIOptions &= ~VIEWOPT_2_H_RULER);}
516 bool IsViewVRuler(bool bDirect = false) const
518 #if HAVE_FEATURE_DESKTOP
519 return bDirect
520 ? 0 != (nUIOptions & VIEWOPT_2_V_RULER)
521 : !bReadonly && (nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER);
522 #else
523 (void) bDirect;
524 return false;
525 #endif
527 void SetViewVRuler (bool b)
528 { b ? (nUIOptions |= VIEWOPT_2_V_RULER ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER);}
530 // ShadowCursor, switch on/off, get/set color/mode.
531 bool IsShadowCursor() const
532 { return (nUIOptions & VIEWOPT_2_SHADOWCRSR) != 0; }
533 void SetShadowCursor(bool b)
534 { b ? (nUIOptions |= VIEWOPT_2_SHADOWCRSR ) : ( nUIOptions &= ~VIEWOPT_2_SHADOWCRSR); }
536 //move vertical ruler to the right
537 bool IsVRulerRight() const
538 { return (nUIOptions & VIEWOPT_2_V_RULER_RIGHT) != 0; }
539 void SetVRulerRight(bool b)
540 { b ? (nUIOptions |= VIEWOPT_2_V_RULER_RIGHT ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER_RIGHT); }
542 bool IsStarOneSetting() const {return bStarOneSetting; }
543 void SetStarOneSetting(bool bSet) {bStarOneSetting = bSet; }
545 bool IsPagePreview() const {return bIsPagePreview; }
546 void SetPagePreview(bool bSet) { bIsPagePreview= bSet; }
548 sal_uInt8 GetShdwCrsrFillMode() const { return nShdwCrsrFillMode; }
549 void SetShdwCrsrFillMode( sal_uInt8 nMode ) { nShdwCrsrFillMode = nMode; };
551 bool IsShowPlaceHolderFields() const { return bShowPlaceHolderFields; }
552 void SetShowPlaceHolderFields(bool bSet) { bShowPlaceHolderFields = bSet; }
554 static Color& GetDocColor();
555 static Color& GetDocBoundariesColor();
556 static Color& GetAppBackgroundColor();
557 static Color& GetObjectBoundariesColor();
558 static Color& GetTableBoundariesColor();
559 static Color& GetIndexShadingsColor();
560 static Color& GetLinksColor();
561 static Color& GetVisitedLinksColor();
562 static Color& GetDirectCursorColor();
563 static Color& GetTextGridColor();
564 static Color& GetSpellColor();
565 static Color& GetSmarttagColor();
566 static Color& GetShadowColor();
567 static Color& GetFontColor();
568 static Color& GetFieldShadingsColor();
569 static Color& GetSectionBoundColor();
570 static Color& GetPageBreakColor();
571 static Color& GetHeaderFooterMarkColor();
573 static bool IsAppearanceFlag(sal_Int32 nFlag);
575 static bool IsDocBoundaries() {return IsAppearanceFlag(VIEWOPT_DOC_BOUNDARIES);}
576 static bool IsObjectBoundaries(){return IsAppearanceFlag(VIEWOPT_OBJECT_BOUNDARIES);}
577 static bool IsTableBoundaries() {return IsAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES );}
578 static bool IsIndexShadings() {return IsAppearanceFlag(VIEWOPT_INDEX_SHADINGS );}
579 static bool IsLinks() {return IsAppearanceFlag(VIEWOPT_LINKS );}
580 static bool IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS );}
581 static bool IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS);}
582 static bool IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES);}
583 static bool IsShadow() {return IsAppearanceFlag(VIEWOPT_SHADOW );}
585 static void SetAppearanceFlag(sal_Int32 nFlag, bool bSet, bool bSaveInConfig = false);
587 static void SetDocBoundaries(bool bSet) {SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bSet);}
589 static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
592 inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
594 return IsEqualFlags( rOpt ) && nZoom == rOpt.GetZoom();
597 inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
599 nUIOptions = rVOpt.nUIOptions;
600 nTableDest = rVOpt.nTableDest;
601 nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
604 // Helper function for checking HTML-capabilities.
605 SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*);
607 #endif
609 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */