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