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