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