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