LibreOffice Module sw (master)  1
viewopt.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SW_INC_VIEWOPT_HXX
21 #define INCLUDED_SW_INC_VIEWOPT_HXX
22 
23 #include <config_features.h>
24 
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
27 
28 #include <sfx2/zoomitem.hxx>
29 #include "swdllapi.h"
30 
31 class SwRect;
32 namespace vcl { class Window; }
33 class OutputDevice;
34 class SwDocShell;
35 namespace svtools{ class ColorConfig;}
36 
37 enum class ViewOptFlags1 {
38  UseHeaderFooterMenu = 0x00000001,
39  Tab = 0x00000002,
40  Blank = 0x00000004,
41  HardBlank = 0x00000008,
42  Paragraph = 0x00000010,
43  Linebreak = 0x00000020,
44  Pagebreak = 0x00000040,
45  Columnbreak = 0x00000080,
46  SoftHyph = 0x00000100,
47  Ref = 0x00000400,
48  FieldName = 0x00000800,
49  Postits = 0x00004000,
50  FieldHidden = 0x00008000,
51  CharHidden = 0x00010000,
52  Graphic = 0x00020000,
53  Table = 0x00040000,
54  Draw = 0x00080000,
55  Control = 0x00100000,
56  Crosshair = 0x00400000,
57  Snap = 0x00800000,
58  Synchronize = 0x01000000,
59  GridVisible = 0x02000000,
60  OnlineSpell = 0x04000000,
61  ShowInlineTooltips = 0x10000000, //tooltips on tracked changes
62  ViewMetachars = 0x20000000,
63  Pageback = 0x40000000
64 };
65 namespace o3tl {
66  template<> struct typed_flags<ViewOptFlags1> : is_typed_flags<ViewOptFlags1, 0x77dfcdff> {};
67 }
68 
69 enum class ViewOptCoreFlags2 {
70  BlackFont = 0x0001,
71  HiddenPara = 0x0002,
72  SmoothScroll = 0x0004,
73  CursorInProt = 0x0008,
74  PdfExport = 0x0010,
75  Printing = 0x0020,
76 };
77 namespace o3tl {
78  template<> struct typed_flags<ViewOptCoreFlags2> : is_typed_flags<ViewOptCoreFlags2, 0x007f> {};
79 };
80 
81 enum class ViewOptFlags2 {
82  HRuler = 0x00000400,
83  VScrollbar = 0x00000800,
84  HScrollbar = 0x00001000,
85  VRuler = 0x00004000,
86  AnyRuler = 0x00008000,
87  Modified = 0x00010000,
88  KeepAspectRatio = 0x00020000,
89  GrfKeepZoom = 0x00040000,
90  ContentTips = 0x00100000,
91  ScrollbarTips = 0x00400000,
92  PrintFormat = 0x00800000,
93  ShadowCursor = 0x01000000,
94  VRulerRight = 0x02000000
95 };
96 namespace o3tl {
97  template<> struct typed_flags<ViewOptFlags2> : is_typed_flags<ViewOptFlags2, 0x03d7dc00> {};
98 };
99 
100 // Table background.
101 #define TBL_DEST_CELL 0
102 #define TBL_DEST_ROW 1
103 #define TBL_DEST_TBL 2
104 
105 // Appearance flags.
106 enum class ViewOptFlags {
107  NONE = 0x0000,
108  DocBoundaries = 0x0001,
109  ObjectBoundaries = 0x0002,
110  TableBoundaries = 0x0004,
111  IndexShadings = 0x0008,
112  Links = 0x0010,
113  VisitedLinks = 0x0020,
114  FieldShadings = 0x0040,
115  SectionBoundaries = 0x0080,
116  Shadow = 0x0100,
117 };
118 namespace o3tl {
119  template<> struct typed_flags<ViewOptFlags> : is_typed_flags<ViewOptFlags, 0x01ff> {};
120 }
121 
123 {
124  static Color s_aDocColor; // color of document boundaries
125  static Color s_aDocBoundColor; // color of document boundaries
126  static Color s_aObjectBoundColor; // color of object boundaries
127  static Color s_aAppBackgroundColor; // application background
128  static Color s_aTableBoundColor; // color of table boundaries
130  static Color s_aIndexShadingsColor; // background color of indexes
135  static Color s_aSpellColor; // mark color of online spell checking
143 
145  static sal_uInt16 s_nPixelTwips;// 1 Pixel == ? Twips
146 
147  OUString m_sSymbolFont; // Symbolfont.
148  ViewOptFlags1 m_nCoreOptions; // Bits for SwViewShell.
149  ViewOptCoreFlags2 m_nCore2Options; // Bits for SwViewShell.
151  Color m_aRetouchColor; // DefaultBackground for BrowseView
152  Size m_aSnapSize; // Describes horizontal and vertical snap.
153  sal_uInt16 mnViewLayoutColumns; // # columns for edit view
154  short m_nDivisionX; // Grid division.
156  sal_uInt8 m_nPagePreviewRow; // Page Preview Row/Columns.
157  sal_uInt8 m_nPagePreviewCol; // Page Preview Row/Columns.
158  sal_uInt8 m_nShadowCursorFillMode; // FillMode for ShadowCursor.
159  bool m_bReadonly : 1; // Readonly-Doc.
160  bool m_bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
161  bool m_bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
162  bool m_bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents.
163  bool mbFormView : 1;
164  bool mbBrowseMode : 1;
165  bool mbBookView : 1; // View mode for page preview.
166  bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
167  bool mbHideWhitespaceMode : 1; // Hide header, footer, and pagebreak.
168  bool m_bShowPlaceHolderFields : 1; // Only used in printing!
169  mutable bool m_bIdle;
170 
171  // Scale
172  sal_uInt16 m_nZoom; // In percent.
173  SvxZoomType m_eZoom; // 'enum' for zoom.
174 
175  sal_uInt8 m_nTableDestination; // Destination for table background.
176 
177 #ifdef DBG_UTIL
178  // Corresponds to statements in ui/config/cfgvw.src.
179  bool m_bTest1 :1; // Test-flag "Layout not loading"
180  bool m_bTest2 :1; // Test-flag "WYSIWYG++"
181  bool m_bTest3 :1; // Test-flag ""
182  bool m_bTest4 :1; // Test-flag "WYSIWYG debug"
183  bool m_bTest5 :1; // Test-flag "No idle format"
184  bool m_bTest6 :1; // Test-flag "No screen adj"
185  bool m_bTest7 :1; // Test-flag "win format"
186  bool m_bTest8 :1; // Test-flag ""
187  bool m_bTest10 :1; // Test-Flag "Format by Input"
188 #endif
189 
190 public:
191  SwViewOption(); // CTOR
192  SwViewOption(const SwViewOption&);
193  ~SwViewOption();
194 
195  static void Init( vcl::Window const *pWin ); // Initializing of static data.
196 
197  ViewOptFlags1 GetCoreOptions() const {return m_nCoreOptions;}
198  inline void SetUIOptions( const SwViewOption& );
199 
200  // Options from nCoreOptions
201  bool IsIdle() const
202  { return m_bIdle; }
203 
204  // Logically this is a const function since it does not modify the viewoptions
205  // but only effects idle formatting. Of course that member is already implement
206  // in the wrong place here... Also currently there are many const modifying casts in the code
207  // just to call this function on otherwise const objects. Thus declaring it as const now.
208  void SetIdle( bool b ) const
209  { m_bIdle = b; }
210 
211  bool IsTab(bool bHard = false) const
212  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Tab) &&
213  ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
214  void SetTab( bool b )
215  { SetCoreOption(b, ViewOptFlags1::Tab); }
216 
217  bool IsBlank(bool bHard = false) const
218  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Blank) &&
219  ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
220  void SetBlank( bool b )
221  { SetCoreOption(b, ViewOptFlags1::Blank); }
222 
223  bool IsHardBlank() const
224  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::HardBlank); }
225  void SetHardBlank( bool b )
226  { SetCoreOption(b, ViewOptFlags1::HardBlank); }
227 
228  bool IsParagraph(bool bHard = false) const
229  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Paragraph) &&
230  ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
231  void SetParagraph( bool b )
232  { SetCoreOption(b, ViewOptFlags1::Paragraph); }
233 
234  bool IsLineBreak(bool bHard = false) const
235  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Linebreak) &&
236  ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
237  void SetLineBreak( bool b )
238  { SetCoreOption(b, ViewOptFlags1::Linebreak); }
239 
240  void SetPageBreak( bool b )
241  { SetCoreOption(b, ViewOptFlags1::Pagebreak); }
242 
243  void SetColumnBreak( bool b)
244  { SetCoreOption(b, ViewOptFlags1::Columnbreak); }
245 
246  bool IsSoftHyph() const
247  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::SoftHyph); }
248  void SetSoftHyph( bool b )
249  { SetCoreOption(b, ViewOptFlags1::SoftHyph); }
250 
251  bool IsFieldName() const { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldName); }
252  void SetFieldName( bool b )
253  { SetCoreOption(b, ViewOptFlags1::FieldName); }
254 
255  bool IsPostIts() const
256  { return bool(m_nCoreOptions & ViewOptFlags1::Postits); }
257  void SetPostIts( bool b )
258  { SetCoreOption(b, ViewOptFlags1::Postits); }
259  static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
260  bool bIsScript );
261  static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut );
262 
263  //show/hide tooltips on tracked changes
264  bool IsShowInlineTooltips() const
265  { return bool(m_nCoreOptions & ViewOptFlags1::ShowInlineTooltips); }
266  void SetShowInlineTooltips( bool b )
267  { SetCoreOption(b, ViewOptFlags1::ShowInlineTooltips); }
268 
269  //show/hide interactive header/footer on top/bottom of pages
271  { return bool(m_nCoreOptions & ViewOptFlags1::UseHeaderFooterMenu ); }
272  void SetUseHeaderFooterMenu( bool b )
273  { SetCoreOption(b, ViewOptFlags1::UseHeaderFooterMenu); }
274 
275  bool IsShowHiddenChar(bool bHard = false) const
276  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::CharHidden) &&
277  ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
278 
279  void SetShowHiddenChar( bool b )
280  { SetCoreOption(b, ViewOptFlags1::CharHidden); }
281 
282  bool IsShowHiddenField() const
283  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldHidden); }
284  void SetShowHiddenField( bool b )
285  { SetCoreOption(b, ViewOptFlags1::FieldHidden); }
286 
287  bool IsGraphic() const
288  { return bool(m_nCoreOptions & ViewOptFlags1::Graphic); }
289  void SetGraphic( bool b )
290  { SetCoreOption(b, ViewOptFlags1::Graphic); }
291 
292  bool IsPageBack() const
293  { return bool(m_nCoreOptions & ViewOptFlags1::Pageback); }
294  void SetPageBack( bool b )
295  { SetCoreOption(b, ViewOptFlags1::Pageback); }
296 
297  bool IsTable() const
298  { return bool(m_nCoreOptions & ViewOptFlags1::Table); }
299  void SetTable( bool b )
300  { SetCoreOption(b, ViewOptFlags1::Table); }
301 
302  bool IsDraw() const
303  { return bool(m_nCoreOptions & ViewOptFlags1::Draw); }
304  void SetDraw( bool b )
305  { SetCoreOption(b, ViewOptFlags1::Draw); }
306 
307  bool IsControl() const
308  { return bool(m_nCoreOptions & ViewOptFlags1::Control); }
309  void SetControl( bool b )
310  { SetCoreOption(b, ViewOptFlags1::Control); }
311 
312  bool IsSnap() const
313  { return bool(m_nCoreOptions & ViewOptFlags1::Snap); }
314  void SetSnap( bool b )
315  { SetCoreOption(b, ViewOptFlags1::Snap); }
316 
317  void SetSnapSize( Size const &rSz ){ m_aSnapSize = rSz; }
318  const Size &GetSnapSize() const { return m_aSnapSize; }
319 
320  bool IsGridVisible() const
321  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::GridVisible); }
322  void SetGridVisible( bool b )
323  { SetCoreOption(b, ViewOptFlags1::GridVisible); }
324 
325  bool IsOnlineSpell() const
326  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::OnlineSpell); }
327  void SetOnlineSpell( bool b );
328 
329  bool IsViewMetaChars() const
330  { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::ViewMetachars); }
331  void SetViewMetaChars( bool b)
332  { SetCoreOption(b, ViewOptFlags1::ViewMetachars); }
333 
334  bool IsSynchronize() const
335  { return bool(m_nCoreOptions & ViewOptFlags1::Synchronize); }
336  void SetSynchronize( bool b )
337  { SetCoreOption(b, ViewOptFlags1::Synchronize); }
338 
339  bool IsCrossHair() const
340  { return bool(m_nCoreOptions & ViewOptFlags1::Crosshair); }
341  void SetCrossHair( bool b )
342  { SetCoreOption(b, ViewOptFlags1::Crosshair); }
343 
344  // Options from nCore2Options
345  bool IsBlackFont() const
346  {return bool(m_nCore2Options & ViewOptCoreFlags2::BlackFont); }
347 
348  void SetBlackFont(bool b)
349  { SetCore2Option(b, ViewOptCoreFlags2::BlackFont); }
350 
351  bool IsShowHiddenPara() const
352  {return bool(m_nCore2Options & ViewOptCoreFlags2::HiddenPara); }
353 
354  void SetShowHiddenPara(bool b)
355  { SetCore2Option(b, ViewOptCoreFlags2::HiddenPara); }
356 
357  bool IsSmoothScroll() const
358  {return bool(m_nCore2Options & ViewOptCoreFlags2::SmoothScroll); }
359 
360  void SetSmoothScroll(bool b)
361  { SetCore2Option(b, ViewOptCoreFlags2::SmoothScroll); }
362 
364  {return bool(m_nCore2Options & ViewOptCoreFlags2::CursorInProt); }
365 
367  { SetCore2Option(b, ViewOptCoreFlags2::CursorInProt); }
368 
369  static bool IsIgnoreProtectedArea();
370 
371  bool IsPDFExport() const
372  {return bool(m_nCore2Options & ViewOptCoreFlags2::PdfExport); }
373 
374  void SetPDFExport(bool b)
375  { SetCore2Option(b, ViewOptCoreFlags2::PdfExport); }
376 
377  bool IsPrinting() const
378  {return bool(m_nCore2Options & ViewOptCoreFlags2::Printing); }
379 
380  void SetPrinting(bool b)
381  { SetCore2Option(b, ViewOptCoreFlags2::Printing); }
382 
384  {
385  if (b)
386  m_nCore2Options |= f;
387  else
388  m_nCore2Options &= ~f;
389  }
390  void SetCoreOption(bool b, ViewOptFlags1 f)
391  {
392  if (b)
393  m_nCoreOptions |= f;
394  else
395  m_nCoreOptions &= ~f;
396  }
397 
398  short GetDivisionX() const { return m_nDivisionX; }
399  void SetDivisionX( short n ){ m_nDivisionX = n; }
400  short GetDivisionY() const { return m_nDivisionY; }
401  void SetDivisionY( short n ){ m_nDivisionY = n; }
402 
403  // Default margin left and above document: 284 twips == 5.0 mm.
404  static constexpr sal_uInt16 defDocumentBorder = 284;
405  // Default gap between pages: 284 twips == 5.0 mm.
406  static constexpr sal_uInt16 defGapBetweenPages = 284;
407  // Minimum edge-to-text distance: 22 twips == 0.4 mm.
408  static constexpr sal_uInt16 minGapBetweenPages = 22;
409 
410  sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? minGapBetweenPages : defDocumentBorder; }
411  sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? minGapBetweenPages : defGapBetweenPages; }
412 
413  sal_uInt8 GetPagePrevRow() const { return m_nPagePreviewRow; }
414  void SetPagePrevRow( sal_uInt8 n ) { m_nPagePreviewRow = n; }
415  sal_uInt8 GetPagePrevCol() const { return m_nPagePreviewCol; }
416  void SetPagePrevCol( sal_uInt8 n ) { m_nPagePreviewCol = n; }
417  bool IsReadonly() const { return m_bReadonly; }
418  void SetReadonly(bool bSet) { m_bReadonly = bSet; }
419 
420  bool IsSelectionInReadonly() const {return m_bSelectionInReadonly;}
421  void SetSelectionInReadonly(bool bSet) {m_bSelectionInReadonly = bSet;}
422 
423  bool IsFormView() const { return mbFormView; }
424  void SetFormView( bool bSet ) { mbFormView = bSet; }
425 
426  bool getBrowseMode() const { return mbBrowseMode; }
427  void setBrowseMode(bool bSet) { mbBrowseMode = bSet; }
428  bool IsPagePrevBookview() const { return mbBookView; }
429  void SetPagePrevBookview(bool bSet) { mbBookView = bSet; }
430 
431  static bool IsAutoCompleteWords();
432 
433  bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
434  void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
435  sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
436  void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
437  bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode; }
438  void SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; }
439 
441  bool CanHideWhitespace() const { return !IsMultipageView(); }
442  bool IsWhitespaceHidden() const { return IsHideWhitespaceMode() && !IsMultipageView(); }
443  bool IsMultipageView() const { return IsViewLayoutBookMode() ||
444  GetViewLayoutColumns() == 0; }
445 
446 #ifdef DBG_UTIL
447  // Correspond to statements in ui/config/cfgvw.src.
448  bool IsTest1() const { return m_bTest1; }
449  bool IsTest2() const { return m_bTest2; }
450  bool IsTest3() const { return m_bTest3; }
451  bool IsTest4() const { return m_bTest4; }
452  bool IsTest5() const { return m_bTest5; }
453  bool IsTest6() const { return m_bTest6; }
454  bool IsTest7() const { return m_bTest7; }
455  bool IsTest8() const { return m_bTest8; }
456  bool IsTest10() const { return m_bTest10; }
457 #endif
458 
459  sal_uInt16 GetZoom() const { return m_nZoom; }
460  void SetZoom( sal_uInt16 n ){ m_nZoom = n; }
461 
462  static void DrawRect( OutputDevice* pOut, const SwRect &rRect, ::Color nCol );
463  static void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect );
464 
465  SwViewOption& operator=( const SwViewOption &rOpt );
466 
467  // Compare methods.
468  bool IsEqualFlags ( const SwViewOption &rOpt ) const;
469  inline bool operator == ( const SwViewOption &rOpt ) const;
470  bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); }
471 
472  // Options from nUIOptions
473  bool IsViewVScrollBar() const
474  {
475 #if HAVE_FEATURE_DESKTOP
476  return bool(m_nUIOptions & ViewOptFlags2::VScrollbar);
477 #else
478  return false;
479 #endif
480  }
481  bool IsViewHScrollBar() const
482  {
483 #if HAVE_FEATURE_DESKTOP
484  return bool(m_nUIOptions & ViewOptFlags2::HScrollbar);
485 #else
486  return false;
487 #endif
488  }
489  bool IsKeepRatio() const
490  { return bool(m_nUIOptions & ViewOptFlags2::KeepAspectRatio); }
491  bool IsGrfKeepZoom() const
492  { return bool(m_nUIOptions & ViewOptFlags2::GrfKeepZoom); }
493  bool IsShowContentTips() const
494  { return bool(m_nUIOptions & ViewOptFlags2::ContentTips); }
495  bool IsPrtFormat() const
496  { return bool(m_nUIOptions & ViewOptFlags2::PrintFormat); }
497  bool IsShowScrollBarTips() const
498  { return bool(m_nUIOptions & ViewOptFlags2::ScrollbarTips); }
499 
500  SvxZoomType GetZoomType() const { return m_eZoom; }
501 
502  sal_uInt8 GetTableDest() const { return m_nTableDestination; }
503 
504  void SetViewVScrollBar(bool b)
505  { SetUIOption(b, ViewOptFlags2::VScrollbar); }
506  void SetViewHScrollBar(bool b)
507  { SetUIOption(b, ViewOptFlags2::HScrollbar); }
508  void SetKeepRatio (bool b)
509  { SetUIOption(b, ViewOptFlags2::KeepAspectRatio); }
510  void SetGrfKeepZoom (bool b)
511  { SetUIOption(b, ViewOptFlags2::GrfKeepZoom); }
512  void SetShowContentTips( bool b)
513  { SetUIOption(b, ViewOptFlags2::ContentTips); }
514  void SetPrtFormat( bool b)
515  { SetUIOption(b, ViewOptFlags2::PrintFormat); }
516  void SetShowScrollBarTips( bool b)
517  { SetUIOption(b, ViewOptFlags2::ScrollbarTips); }
518  void SetUIOption( bool b, ViewOptFlags2 f)
519  {
520  if (b)
521  m_nUIOptions |= f;
522  else
523  m_nUIOptions &= ~f;
524  }
525 
526  void SetZoomType (SvxZoomType eZoom_){ m_eZoom = eZoom_; }
527  void SetTableDest( sal_uInt8 nNew ) { m_nTableDestination = nNew; }
528 
529  const OUString& GetSymbolFont() const {return m_sSymbolFont;}
530  void SetSymbolFont(const OUString& sSet) {m_sSymbolFont = sSet;}
531 
532  const Color& GetRetoucheColor() const { return m_aRetouchColor;}
533  void SetRetoucheColor(const Color&r) { m_aRetouchColor = r; }
534 
535  bool IsViewAnyRuler() const
536  {
537 #if HAVE_FEATURE_DESKTOP
538  return bool(m_nUIOptions & ViewOptFlags2::AnyRuler);
539 #else
540  return false;
541 #endif
542  }
543  void SetViewAnyRuler(bool bSet)
544  { SetUIOption(bSet, ViewOptFlags2::AnyRuler);}
545 
546  bool IsViewHRuler(bool bDirect = false) const
547  {
548 #if HAVE_FEATURE_DESKTOP
549  return bDirect
550  ? bool(m_nUIOptions & ViewOptFlags2::HRuler)
552 #else
553  (void) bDirect;
554  return false;
555 #endif
556  }
557  void SetViewHRuler (bool b)
558  { SetUIOption(b, ViewOptFlags2::HRuler ); }
559 
560  bool IsViewVRuler(bool bDirect = false) const
561  {
562 #if HAVE_FEATURE_DESKTOP
563  return bDirect
564  ? bool(m_nUIOptions & ViewOptFlags2::VRuler)
566 #else
567  (void) bDirect;
568  return false;
569 #endif
570  }
571  void SetViewVRuler (bool b)
572  { SetUIOption(b, ViewOptFlags2::VRuler); }
573 
574  // ShadowCursor, switch on/off, get/set color/mode.
575  bool IsShadowCursor() const
576  { return bool(m_nUIOptions & ViewOptFlags2::ShadowCursor); }
577  void SetShadowCursor(bool b)
578  { SetUIOption(b, ViewOptFlags2::ShadowCursor); }
579 
580  //move vertical ruler to the right
581  bool IsVRulerRight() const
582  { return bool(m_nUIOptions & ViewOptFlags2::VRulerRight); }
583  void SetVRulerRight(bool b)
584  { SetUIOption(b, ViewOptFlags2::VRulerRight); }
585 
586  bool IsStarOneSetting() const {return m_bStarOneSetting; }
587  void SetStarOneSetting(bool bSet) {m_bStarOneSetting = bSet; }
588 
589  bool IsPagePreview() const {return m_bIsPagePreview; }
590  void SetPagePreview(bool bSet) { m_bIsPagePreview= bSet; }
591 
592  sal_uInt8 GetShdwCursorFillMode() const { return m_nShadowCursorFillMode; }
593  void SetShdwCursorFillMode( sal_uInt8 nMode ) { m_nShadowCursorFillMode = nMode; };
594 
595  bool IsShowPlaceHolderFields() const { return m_bShowPlaceHolderFields; }
596  void SetShowPlaceHolderFields(bool bSet) { m_bShowPlaceHolderFields = bSet; }
597 
598  static Color& GetDocColor();
599  static Color& GetDocBoundariesColor();
600  static Color& GetAppBackgroundColor();
601  static Color& GetObjectBoundariesColor();
602  static Color& GetTableBoundariesColor();
603  static Color& GetIndexShadingsColor();
604  static Color& GetLinksColor();
605  static Color& GetVisitedLinksColor();
606  static Color& GetDirectCursorColor();
607  static Color& GetTextGridColor();
608  static Color& GetSpellColor();
609  static Color& GetSmarttagColor();
610  static Color& GetShadowColor();
611  static Color& GetFontColor();
612  static Color& GetFieldShadingsColor();
613  static Color& GetSectionBoundColor();
614  static Color& GetPageBreakColor();
615  static Color& GetHeaderFooterMarkColor();
616 
617  static bool IsAppearanceFlag(ViewOptFlags nFlag);
618 
619  static bool IsDocBoundaries() {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);}
620  static bool IsObjectBoundaries() {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);}
621  static bool IsTableBoundaries() {return IsAppearanceFlag(ViewOptFlags::TableBoundaries );}
622  static bool IsIndexShadings() {return IsAppearanceFlag(ViewOptFlags::IndexShadings );}
623  static bool IsLinks() {return IsAppearanceFlag(ViewOptFlags::Links );}
624  static bool IsVisitedLinks() {return IsAppearanceFlag(ViewOptFlags::VisitedLinks );}
625  static bool IsFieldShadings() {return IsAppearanceFlag(ViewOptFlags::FieldShadings);}
626  static bool IsSectionBoundaries() {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);}
627  static bool IsShadow() {return IsAppearanceFlag(ViewOptFlags::Shadow );}
628 
629  static void SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false);
630 
631  static void SetDocBoundaries(bool bSet) {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);}
632 
633  static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
634 };
635 
636 inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
637 {
638  return IsEqualFlags( rOpt ) && m_nZoom == rOpt.GetZoom();
639 }
640 
641 inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
642 {
643  m_nUIOptions = rVOpt.m_nUIOptions;
646 }
647 
648 // Helper function for checking HTML-capabilities.
649 SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*);
650 
651 #endif
652 
653 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLineBreak(bool b)
Definition: viewopt.hxx:237
bool IsSynchronize() const
Definition: viewopt.hxx:334
void SetShowPlaceHolderFields(bool bSet)
Definition: viewopt.hxx:596
bool IsViewMetaChars() const
Definition: viewopt.hxx:329
bool IsSmoothScroll() const
Definition: viewopt.hxx:357
const Color & GetRetoucheColor() const
Definition: viewopt.hxx:532
bool IsShowScrollBarTips() const
Definition: viewopt.hxx:497
void SetShowContentTips(bool b)
Definition: viewopt.hxx:512
static Color s_aSectionBoundColor
Definition: viewopt.hxx:138
void SetShowScrollBarTips(bool b)
Definition: viewopt.hxx:516
bool IsTest4() const
Definition: viewopt.hxx:451
bool IsPagePreview() const
Definition: viewopt.hxx:589
bool operator==(const SwViewOption &rOpt) const
Definition: viewopt.hxx:636
void SetSoftHyph(bool b)
Definition: viewopt.hxx:248
void SetReadonly(bool bSet)
Definition: viewopt.hxx:418
ViewOptFlags
Definition: viewopt.hxx:106
void Init()
static bool IsVisitedLinks()
Definition: viewopt.hxx:624
void SetDivisionX(short n)
Definition: viewopt.hxx:399
static bool IsDocBoundaries()
Definition: viewopt.hxx:619
ViewOptCoreFlags2 m_nCore2Options
Definition: viewopt.hxx:149
void SetPageBack(bool b)
Definition: viewopt.hxx:294
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:460
static Color s_aLinksColor
Definition: viewopt.hxx:131
bool IsShowContentTips() const
Definition: viewopt.hxx:493
bool IsViewAnyRuler() const
Definition: viewopt.hxx:535
sal_uInt8 GetShdwCursorFillMode() const
Definition: viewopt.hxx:592
bool IsPrinting() const
Definition: viewopt.hxx:377
bool IsGraphic() const
Definition: viewopt.hxx:287
void SetShowInlineTooltips(bool b)
Definition: viewopt.hxx:266
bool IsPostIts() const
Definition: viewopt.hxx:255
static void SetDocBoundaries(bool bSet)
Definition: viewopt.hxx:631
bool IsTest10() const
Definition: viewopt.hxx:456
bool IsEqualFlags(const SwViewOption &rOpt) const
Definition: viewopt.cxx:69
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:436
bool IsPageBack() const
Definition: viewopt.hxx:292
Color GetFontColor()
bool IsTest8() const
Definition: viewopt.hxx:455
bool IsHardBlank() const
Definition: viewopt.hxx:223
static Color s_aTableBoundColor
Definition: viewopt.hxx:128
static Color s_aFontColor
Definition: viewopt.hxx:129
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
static ViewOptFlags s_nAppearanceFlags
Definition: viewopt.hxx:144
void SetHardBlank(bool b)
Definition: viewopt.hxx:225
static sal_uInt16 s_nPixelTwips
Definition: viewopt.hxx:145
bool IsShowHiddenPara() const
Definition: viewopt.hxx:351
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:279
static bool IsObjectBoundaries()
Definition: viewopt.hxx:620
void SetColumnBreak(bool b)
Definition: viewopt.hxx:243
void SetGrfKeepZoom(bool b)
Definition: viewopt.hxx:510
void SetPrtFormat(bool b)
Definition: viewopt.hxx:514
void SetPagePrevRow(sal_uInt8 n)
Definition: viewopt.hxx:414
bool CanHideWhitespace() const
The rules that allow for hiding whitespace.
Definition: viewopt.hxx:441
void SetKeepRatio(bool b)
Definition: viewopt.hxx:508
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:500
void SetUseHeaderFooterMenu(bool b)
Definition: viewopt.hxx:272
bool IsFieldName() const
Definition: viewopt.hxx:251
bool IsReadonly() const
Definition: viewopt.hxx:417
sal_uInt16 GetDocumentBorder() const
Definition: viewopt.hxx:410
static Color s_aDocBoundColor
Definition: viewopt.hxx:125
short m_nDivisionX
Definition: viewopt.hxx:154
short GetDivisionX() const
Definition: viewopt.hxx:398
void SetCursorInProtectedArea(bool b)
Definition: viewopt.hxx:366
void SetParagraph(bool b)
Definition: viewopt.hxx:231
bool getBrowseMode() const
Definition: viewopt.hxx:426
void SetCoreOption(bool b, ViewOptFlags1 f)
Definition: viewopt.hxx:390
short GetDivisionY() const
Definition: viewopt.hxx:400
ViewOptFlags2 m_nUIOptions
Definition: viewopt.hxx:150
void SetSynchronize(bool b)
Definition: viewopt.hxx:336
static bool IsSectionBoundaries()
Definition: viewopt.hxx:626
ViewOptFlags1
Definition: viewopt.hxx:37
void setBrowseMode(bool bSet)
Definition: viewopt.hxx:427
bool IsViewVScrollBar() const
Definition: viewopt.hxx:473
static Color s_aAppBackgroundColor
Definition: viewopt.hxx:127
void SetPDFExport(bool b)
Definition: viewopt.hxx:374
bool IsViewHRuler(bool bDirect=false) const
Definition: viewopt.hxx:546
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:354
bool IsBlank(bool bHard=false) const
Definition: viewopt.hxx:217
static Color s_aVisitedLinksColor
Definition: viewopt.hxx:132
bool IsShadowCursor() const
Definition: viewopt.hxx:575
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:438
ViewOptCoreFlags2
Definition: viewopt.hxx:69
void SetTableDest(sal_uInt8 nNew)
Definition: viewopt.hxx:527
sal_uInt16 mnViewLayoutColumns
Definition: viewopt.hxx:153
static Color s_aFieldShadingsColor
Definition: viewopt.hxx:137
bool IsMultipageView() const
Definition: viewopt.hxx:443
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:526
void SetSmoothScroll(bool b)
Definition: viewopt.hxx:360
bool IsCursorInProtectedArea() const
Definition: viewopt.hxx:363
bool IsDraw() const
Definition: viewopt.hxx:302
bool IsCrossHair() const
Definition: viewopt.hxx:339
void SetFormView(bool bSet)
Definition: viewopt.hxx:424
void SetDraw(bool b)
Definition: viewopt.hxx:304
OUString m_sSymbolFont
Definition: viewopt.hxx:147
void SetPagePrevCol(sal_uInt8 n)
Definition: viewopt.hxx:416
static Color s_aDocColor
Definition: viewopt.hxx:124
void SetSymbolFont(const OUString &sSet)
Definition: viewopt.hxx:530
sal_uInt8 m_nPagePreviewCol
Definition: viewopt.hxx:157
void SetTable(bool b)
Definition: viewopt.hxx:299
SvxZoomType m_eZoom
Definition: viewopt.hxx:173
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:433
void SetPrinting(bool b)
Definition: viewopt.hxx:380
bool IsFormView() const
Definition: viewopt.hxx:423
ViewOptFlags1 m_nCoreOptions
Definition: viewopt.hxx:148
static bool IsIndexShadings()
Definition: viewopt.hxx:622
sal_uInt8 m_nShadowCursorFillMode
Definition: viewopt.hxx:158
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:284
void SetTab(bool b)
Definition: viewopt.hxx:214
bool IsIdle() const
Definition: viewopt.hxx:201
short m_nDivisionY
Definition: viewopt.hxx:155
void SetPagePreview(bool bSet)
Definition: viewopt.hxx:590
Color m_aRetouchColor
Definition: viewopt.hxx:151
bool IsParagraph(bool bHard=false) const
Definition: viewopt.hxx:228
bool IsViewVRuler(bool bDirect=false) const
Definition: viewopt.hxx:560
bool IsControl() const
Definition: viewopt.hxx:307
bool IsTab(bool bHard=false) const
Definition: viewopt.hxx:211
bool IsBlackFont() const
Definition: viewopt.hxx:345
void SetViewHRuler(bool b)
Definition: viewopt.hxx:557
bool IsLineBreak(bool bHard=false) const
Definition: viewopt.hxx:234
bool IsPDFExport() const
Definition: viewopt.hxx:371
void SetGraphic(bool b)
Definition: viewopt.hxx:289
bool IsOnlineSpell() const
Definition: viewopt.hxx:325
bool IsPagePrevBookview() const
Definition: viewopt.hxx:428
Size m_aSnapSize
Definition: viewopt.hxx:152
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
void SetCore2Option(bool b, ViewOptCoreFlags2 f)
Definition: viewopt.hxx:383
static bool IsFieldShadings()
Definition: viewopt.hxx:625
void SetViewMetaChars(bool b)
Definition: viewopt.hxx:331
void SetSnapSize(Size const &rSz)
Definition: viewopt.hxx:317
bool IsTest2() const
Definition: viewopt.hxx:449
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:529
bool IsTable() const
Definition: viewopt.hxx:297
void SetFieldName(bool b)
Definition: viewopt.hxx:252
ViewOptFlags2
Definition: viewopt.hxx:81
void SetCrossHair(bool b)
Definition: viewopt.hxx:341
bool IsTest5() const
Definition: viewopt.hxx:452
sal_uInt8 GetPagePrevRow() const
Definition: viewopt.hxx:413
bool m_bIdle
Definition: viewopt.hxx:169
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:437
bool IsVRulerRight() const
Definition: viewopt.hxx:581
sal_uInt8 GetTableDest() const
Definition: viewopt.hxx:502
void SetDivisionY(short n)
Definition: viewopt.hxx:401
bool IsTest7() const
Definition: viewopt.hxx:454
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:434
bool IsKeepRatio() const
Definition: viewopt.hxx:489
static Color s_aDirectCursorColor
Definition: viewopt.hxx:133
static bool IsLinks()
Definition: viewopt.hxx:623
static bool IsShadow()
Definition: viewopt.hxx:627
void SetBlackFont(bool b)
Definition: viewopt.hxx:348
bool IsShowInlineTooltips() const
Definition: viewopt.hxx:264
bool IsTest1() const
Definition: viewopt.hxx:448
static Color s_aHeaderFooterMarkColor
Definition: viewopt.hxx:142
unsigned char sal_uInt8
void SetPageBreak(bool b)
Definition: viewopt.hxx:240
void SetRetoucheColor(const Color &r)
Definition: viewopt.hxx:533
void SetIdle(bool b) const
Definition: viewopt.hxx:208
bool IsStarOneSetting() const
Definition: viewopt.hxx:586
const Size & GetSnapSize() const
Definition: viewopt.hxx:318
bool IsGrfKeepZoom() const
Definition: viewopt.hxx:491
sal_uInt16 m_nZoom
Definition: viewopt.hxx:172
static Color s_aShadowColor
Definition: viewopt.hxx:141
void SetShdwCursorFillMode(sal_uInt8 nMode)
Definition: viewopt.hxx:593
void SetPostIts(bool b)
Definition: viewopt.hxx:257
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:459
sal_uInt8 m_nTableDestination
Definition: viewopt.hxx:175
void SetSelectionInReadonly(bool bSet)
Definition: viewopt.hxx:421
static bool IsTableBoundaries()
Definition: viewopt.hxx:621
void SetViewVScrollBar(bool b)
Definition: viewopt.hxx:504
bool IsTest6() const
Definition: viewopt.hxx:453
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:270
static Color s_aSmarttagColor
Definition: viewopt.hxx:136
bool IsPrtFormat() const
Definition: viewopt.hxx:495
static Color s_aIndexShadingsColor
Definition: viewopt.hxx:130
void SetVRulerRight(bool b)
Definition: viewopt.hxx:583
void SetShadowCursor(bool b)
Definition: viewopt.hxx:577
bool IsSoftHyph() const
Definition: viewopt.hxx:246
SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell *)
Definition: viewopt.cxx:339
void SetSnap(bool b)
Definition: viewopt.hxx:314
bool IsGridVisible() const
Definition: viewopt.hxx:320
void SetStarOneSetting(bool bSet)
Definition: viewopt.hxx:587
void SetViewVRuler(bool b)
Definition: viewopt.hxx:571
void SetControl(bool b)
Definition: viewopt.hxx:309
static Color s_aPageBreakColor
Definition: viewopt.hxx:139
static Color s_aTextGridColor
Definition: viewopt.hxx:134
SvxZoomType
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:275
void SetViewHScrollBar(bool b)
Definition: viewopt.hxx:506
static Color s_aObjectBoundColor
Definition: viewopt.hxx:126
void SetGridVisible(bool b)
Definition: viewopt.hxx:322
sal_uInt8 m_nPagePreviewRow
Definition: viewopt.hxx:156
static Color s_aSpellColor
Definition: viewopt.hxx:135
bool IsShowHiddenField() const
Definition: viewopt.hxx:282
void SetViewAnyRuler(bool bSet)
Definition: viewopt.hxx:543
bool IsSnap() const
Definition: viewopt.hxx:312
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:442
void SetPagePrevBookview(bool bSet)
Definition: viewopt.hxx:429
bool IsTest3() const
Definition: viewopt.hxx:450
bool IsViewHScrollBar() const
Definition: viewopt.hxx:481
void SetUIOptions(const SwViewOption &)
Definition: viewopt.hxx:641
sal_uInt8 GetPagePrevCol() const
Definition: viewopt.hxx:415
void SetUIOption(bool b, ViewOptFlags2 f)
Definition: viewopt.hxx:518
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:435
ViewOptFlags1 GetCoreOptions() const
Definition: viewopt.hxx:197
static Color s_aScriptIndicatorColor
Definition: viewopt.hxx:140
sal_uInt16 GetGapBetweenPages() const
Definition: viewopt.hxx:411
bool IsSelectionInReadonly() const
Definition: viewopt.hxx:420
void SetBlank(bool b)
Definition: viewopt.hxx:220
bool IsShowPlaceHolderFields() const
Definition: viewopt.hxx:595
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo