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