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