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