1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
33 namespace vcl
{ class Window
; }
36 namespace svtools
{ class ColorConfig
;}
37 enum class SwFillMode
;
39 enum class ViewOptFlags1
: sal_uInt64
{
40 UseHeaderFooterMenu
= 0x00000001,
43 HardBlank
= 0x00000008,
44 Paragraph
= 0x00000010,
45 Linebreak
= 0x00000020,
46 Pagebreak
= 0x00000040,
47 Columnbreak
= 0x00000080,
48 SoftHyph
= 0x00000100,
49 Bookmarks
= 0x00000200,
51 FieldName
= 0x00000800,
53 FieldHidden
= 0x00008000,
54 CharHidden
= 0x00010000,
59 Crosshair
= 0x00400000,
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
71 template<> struct typed_flags
<ViewOptFlags1
> : is_typed_flags
<ViewOptFlags1
, 0x1F7dfcfff> {};
74 enum class ViewOptCoreFlags2
{
77 SmoothScroll
= 0x0004,
78 CursorInProt
= 0x0008,
83 template<> struct typed_flags
<ViewOptCoreFlags2
> : is_typed_flags
<ViewOptCoreFlags2
, 0x003f> {};
86 enum class ViewOptFlags2
{
88 VScrollbar
= 0x00000800,
89 HScrollbar
= 0x00001000,
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,
103 template<> struct typed_flags
<ViewOptFlags2
> : is_typed_flags
<ViewOptFlags2
, 0x07d7dc00> {};
107 #define TBL_DEST_CELL 0
108 #define TBL_DEST_ROW 1
109 #define TBL_DEST_TBL 2
112 enum class ViewOptFlags
{
114 DocBoundaries
= 0x0001,
115 ObjectBoundaries
= 0x0002,
116 TableBoundaries
= 0x0004,
117 IndexShadings
= 0x0008,
119 VisitedLinks
= 0x0020,
120 FieldShadings
= 0x0040,
121 SectionBoundaries
= 0x0080,
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.
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.
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
179 sal_uInt16 m_nZoom
; // In percent.
180 SvxZoomType m_eZoom
; // 'enum' for zoom.
182 sal_uInt8 m_nTableDestination
; // Destination for table background.
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"
198 SwViewOption(); // CTOR
199 SwViewOption(const 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
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
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
,
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
); }
332 { return bool(m_nCoreOptions
& ViewOptFlags1::Table
); }
333 void SetTable( bool b
)
334 { SetCoreOption(b
, ViewOptFlags1::Table
); }
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
); }
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
)
420 m_nCore2Options
|= f
;
422 m_nCore2Options
&= ~f
;
424 void SetCoreOption(bool b
, ViewOptFlags1 f
)
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; }
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
; }
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
);
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
);
515 bool IsViewHScrollBar() const
517 #if HAVE_FEATURE_DESKTOP
518 return bool(m_nUIOptions
& ViewOptFlags2::HScrollbar
);
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
)
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
);
577 void SetViewAnyRuler(bool bSet
)
578 { SetUIOption(bSet
, ViewOptFlags2::AnyRuler
);}
580 bool IsViewHRuler(bool bDirect
= false) const
582 #if HAVE_FEATURE_DESKTOP
584 ? bool(m_nUIOptions
& ViewOptFlags2::HRuler
)
585 : !m_bReadonly
&& (m_nUIOptions
& (ViewOptFlags2::AnyRuler
|ViewOptFlags2::HRuler
)) == (ViewOptFlags2::AnyRuler
|ViewOptFlags2::HRuler
);
591 void SetViewHRuler (bool b
)
592 { SetUIOption(b
, ViewOptFlags2::HRuler
); }
594 bool IsViewVRuler(bool bDirect
= false) const
596 #if HAVE_FEATURE_DESKTOP
598 ? bool(m_nUIOptions
& ViewOptFlags2::VRuler
)
599 : !m_bReadonly
&& (m_nUIOptions
& (ViewOptFlags2::AnyRuler
|ViewOptFlags2::VRuler
)) == (ViewOptFlags2::AnyRuler
|ViewOptFlags2::VRuler
);
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
*);
695 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */