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