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