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>
35 namespace svtools
{ class ColorConfig
;}
36 enum class SwFillMode
;
40 bool bUseHeaderFooterMenu
: 1;
47 bool bColumnbreak
: 1;
53 bool bFieldHidden
: 1;
61 bool bSynchronize
: 1;
62 bool bGridVisible
: 1;
63 bool bOnlineSpell
: 1;
64 bool bTreatSubOutlineLevelsAsContent
: 1;
65 bool bShowInlineTooltips
: 1; //tooltips on tracked changes
66 bool bViewMetachars
: 1;
68 bool bShowOutlineContentVisibilityButton
: 1;
69 bool bShowChangesInMargin
: 1; //tracked deletions in margin
70 bool bShowChangesInMargin2
: 1; //tracked insertions in margin
73 : bUseHeaderFooterMenu(false)
97 , bTreatSubOutlineLevelsAsContent(false)
98 , bShowInlineTooltips(false)
99 , bViewMetachars(false)
101 , bShowOutlineContentVisibilityButton(false)
102 , bShowChangesInMargin(false)
103 , bShowChangesInMargin2(false)
106 bool operator==(const ViewOptFlags1
& rOther
) const
108 return bUseHeaderFooterMenu
== rOther
.bUseHeaderFooterMenu
109 && bTab
== rOther
.bTab
110 && bBlank
== rOther
.bBlank
111 && bHardBlank
== rOther
.bHardBlank
112 && bParagraph
== rOther
.bParagraph
113 && bLinebreak
== rOther
.bLinebreak
114 && bPagebreak
== rOther
.bPagebreak
115 && bColumnbreak
== rOther
.bColumnbreak
116 && bSoftHyph
== rOther
.bSoftHyph
117 && bBookmarks
== rOther
.bBookmarks
118 && bRef
== rOther
.bRef
119 && bFieldName
== rOther
.bFieldName
120 && bPostits
== rOther
.bPostits
121 && bFieldHidden
== rOther
.bFieldHidden
122 && bCharHidden
== rOther
.bCharHidden
123 && bGraphic
== rOther
.bGraphic
124 && bTable
== rOther
.bTable
125 && bDraw
== rOther
.bDraw
126 && bControl
== rOther
.bControl
127 && bCrosshair
== rOther
.bCrosshair
128 && bSnap
== rOther
.bSnap
129 && bSynchronize
== rOther
.bSynchronize
130 && bGridVisible
== rOther
.bGridVisible
131 && bOnlineSpell
== rOther
.bOnlineSpell
132 && bTreatSubOutlineLevelsAsContent
== rOther
.bTreatSubOutlineLevelsAsContent
133 && bShowInlineTooltips
== rOther
.bShowInlineTooltips
134 && bViewMetachars
== rOther
.bViewMetachars
135 && bPageback
== rOther
.bPageback
136 && bShowOutlineContentVisibilityButton
== rOther
.bShowOutlineContentVisibilityButton
137 && bShowChangesInMargin
== rOther
.bShowChangesInMargin
138 && bShowChangesInMargin2
== rOther
.bShowChangesInMargin2
;
142 enum class ViewOptCoreFlags2
{
145 SmoothScroll
= 0x0004,
146 CursorInProt
= 0x0008,
151 template<> struct typed_flags
<ViewOptCoreFlags2
> : is_typed_flags
<ViewOptCoreFlags2
, 0x003f> {};
154 enum class ViewOptFlags2
{
156 VScrollbar
= 0x00000800,
157 HScrollbar
= 0x00001000,
159 AnyRuler
= 0x00008000,
160 Modified
= 0x00010000,
161 KeepAspectRatio
= 0x00020000,
162 GrfKeepZoom
= 0x00040000,
163 ContentTips
= 0x00100000,
164 ScrollbarTips
= 0x00400000,
165 PrintFormat
= 0x00800000,
166 ShadowCursor
= 0x01000000,
167 VRulerRight
= 0x02000000,
168 ResolvedPostits
= 0x04000000,
171 template<> struct typed_flags
<ViewOptFlags2
> : is_typed_flags
<ViewOptFlags2
, 0x07d7dc00> {};
175 #define TBL_DEST_CELL 0
176 #define TBL_DEST_ROW 1
177 #define TBL_DEST_TBL 2
180 enum class ViewOptFlags
{
182 DocBoundaries
= 0x0001,
183 ObjectBoundaries
= 0x0002,
184 TableBoundaries
= 0x0004,
185 IndexShadings
= 0x0008,
187 VisitedLinks
= 0x0020,
188 FieldShadings
= 0x0040,
189 SectionBoundaries
= 0x0080,
193 template<> struct typed_flags
<ViewOptFlags
> : is_typed_flags
<ViewOptFlags
, 0x01ff> {};
199 SwViewColors(const svtools::ColorConfig
& rConfig
);
200 bool operator==(const SwViewColors
& rOther
) const
202 return m_aDocColor
== rOther
.m_aDocColor
203 && m_aDocBoundColor
== rOther
.m_aDocBoundColor
204 && m_aObjectBoundColor
== rOther
.m_aObjectBoundColor
205 && m_aAppBackgroundColor
== rOther
.m_aAppBackgroundColor
206 && m_aTableBoundColor
== rOther
.m_aTableBoundColor
207 && m_aFontColor
== rOther
.m_aFontColor
208 && m_aIndexShadingsColor
== rOther
.m_aIndexShadingsColor
209 && m_aLinksColor
== rOther
.m_aLinksColor
210 && m_aVisitedLinksColor
== rOther
.m_aVisitedLinksColor
211 && m_aDirectCursorColor
== rOther
.m_aDirectCursorColor
212 && m_aTextGridColor
== rOther
.m_aTextGridColor
213 && m_aSpellColor
== rOther
.m_aSpellColor
214 && m_aGrammarColor
== rOther
.m_aGrammarColor
215 && m_aSmarttagColor
== rOther
.m_aSmarttagColor
216 && m_aFieldShadingsColor
== rOther
.m_aFieldShadingsColor
217 && m_aSectionBoundColor
== rOther
.m_aSectionBoundColor
218 && m_aPageBreakColor
== rOther
.m_aPageBreakColor
219 && m_aScriptIndicatorColor
== rOther
.m_aScriptIndicatorColor
220 && m_aShadowColor
== rOther
.m_aShadowColor
221 && m_aHeaderFooterMarkColor
== rOther
.m_aHeaderFooterMarkColor
222 && m_nAppearanceFlags
== rOther
.m_nAppearanceFlags
;
224 Color m_aDocColor
; // color of document boundaries
225 Color m_aDocBoundColor
; // color of document boundaries
226 Color m_aObjectBoundColor
; // color of object boundaries
227 Color m_aAppBackgroundColor
; // application background
228 Color m_aTableBoundColor
; // color of table boundaries
230 Color m_aIndexShadingsColor
; // background color of indexes
232 Color m_aVisitedLinksColor
;
233 Color m_aDirectCursorColor
;
234 Color m_aTextGridColor
;
235 Color m_aSpellColor
; // mark color of online spell checking
236 Color m_aGrammarColor
;
237 Color m_aSmarttagColor
;
238 Color m_aFieldShadingsColor
;
239 Color m_aSectionBoundColor
;
240 Color m_aPageBreakColor
;
241 Color m_aScriptIndicatorColor
;
242 Color m_aShadowColor
;
243 Color m_aHeaderFooterMarkColor
;
244 ViewOptFlags m_nAppearanceFlags
;
247 class SW_DLLPUBLIC SwViewOption
249 SwViewColors m_aColorConfig
;
250 static SwViewColors s_aInitialColorConfig
;
251 OUString m_sThemeName
;
253 static sal_uInt16 s_nPixelTwips
;// 1 Pixel == ? Twips
255 OUString m_sSymbolFont
; // Symbolfont.
256 ViewOptFlags1 m_nCoreOptions
; // Bits for SwViewShell.
257 ViewOptCoreFlags2 m_nCore2Options
; // Bits for SwViewShell.
258 ViewOptFlags2 m_nUIOptions
; // UI-Bits
259 Color m_aRetouchColor
; // DefaultBackground for BrowseView
260 Size m_aSnapSize
; // Describes horizontal and vertical snap.
261 sal_uInt16 mnViewLayoutColumns
; // # columns for edit view
262 short m_nDivisionX
; // Grid division.
264 sal_uInt8 m_nPagePreviewRow
; // Page Preview Row/Columns.
265 sal_uInt8 m_nPagePreviewCol
; // Page Preview Row/Columns.
266 SwFillMode m_nShadowCursorFillMode
; // FillMode for ShadowCursor.
267 bool m_bReadonly
: 1; // Readonly-Doc.
268 bool m_bStarOneSetting
: 1;// Prevent from UI automatics (no scrollbars in readonly documents).
269 bool m_bIsPagePreview
: 1; // The preview mustn't print field/footnote/... shadings.
270 bool m_bSelectionInReadonly
: 1; // Determines whether selection is switched on in readonly documents.
272 bool mbBrowseMode
: 1;
273 bool mbBookView
: 1; // View mode for page preview.
274 bool mbViewLayoutBookMode
: 1; // Book view mode for edit view.
275 bool mbHideWhitespaceMode
: 1; // Hide header, footer, and pagebreak.
276 bool m_bShowPlaceHolderFields
: 1; // Only used in printing!
277 mutable bool m_bIdle
;
278 sal_Int32 m_nDefaultAnchor
; // GetDefaultAnchorType() to convert int to RndStdIds
281 sal_uInt16 m_nZoom
; // In percent.
282 SvxZoomType m_eZoom
; // 'enum' for zoom.
284 sal_uInt8 m_nTableDestination
; // Destination for table background.
287 // Corresponds to statements in ui/config/cfgvw.src.
288 bool m_bTest1
:1; // Test-flag "Layout not loading"
289 bool m_bTest2
:1; // Test-flag "WYSIWYG++"
290 bool m_bTest3
:1; // Test-flag ""
291 bool m_bTest4
:1; // Test-flag "WYSIWYG debug"
292 bool m_bTest5
:1; // Test-flag "No idle format"
293 bool m_bTest6
:1; // Test-flag "No screen adj"
294 bool m_bTest7
:1; // Test-flag "win format"
295 bool m_bTest8
:1; // Test-flag ""
296 bool m_bTest10
:1; // Test-Flag "Format by Input"
300 SwViewOption(); // CTOR
301 SwViewOption(const SwViewOption
&);
304 static void Init(const OutputDevice
* pWin
); // Initializing of static data.
306 inline void SetUIOptions( const SwViewOption
& );
308 void SetColorConfig(const SwViewColors
& rColorConfig
)
310 m_aColorConfig
= rColorConfig
;
313 const SwViewColors
& GetColorConfig() const
315 return m_aColorConfig
;
318 void SetThemeName(const OUString
& rThemeName
)
320 m_sThemeName
= rThemeName
;
323 OUString
GetThemeName() const
328 static void SetInitialColorConfig(const SwViewColors
& rColorConfig
)
330 s_aInitialColorConfig
= rColorConfig
;
333 // Options from nCoreOptions
337 // Logically this is a const function since it does not modify the viewoptions
338 // but only effects idle formatting. Of course that member is already implement
339 // in the wrong place here... Also currently there are many const modifying casts in the code
340 // just to call this function on otherwise const objects. Thus declaring it as const now.
341 void SetIdle( bool b
) const
344 bool IsTab(bool bHard
= false) const
346 return !m_bReadonly
&& m_nCoreOptions
.bTab
&& (m_nCoreOptions
.bViewMetachars
|| bHard
);
348 void SetTab( bool b
)
350 m_nCoreOptions
.bTab
= b
;
353 bool IsBlank(bool bHard
= false) const
355 return !m_bReadonly
&& m_nCoreOptions
.bBlank
&& (m_nCoreOptions
.bViewMetachars
|| bHard
);
357 void SetBlank(bool b
)
359 m_nCoreOptions
.bBlank
= b
;
362 bool IsHardBlank() const
364 return !m_bReadonly
&& (m_nCoreOptions
.bHardBlank
);
366 void SetHardBlank( bool b
)
368 m_nCoreOptions
.bHardBlank
= b
;
371 bool IsParagraph(bool bHard
= false) const
373 return !m_bReadonly
&& m_nCoreOptions
.bParagraph
&&
374 (m_nCoreOptions
.bViewMetachars
|| bHard
);
376 void SetParagraph( bool b
)
378 m_nCoreOptions
.bParagraph
= b
;
381 void SetShowBookmarks(bool const b
)
383 m_nCoreOptions
.bBookmarks
= b
;
385 bool IsShowBookmarks(bool const bHard
= false) const
387 return !m_bReadonly
&& (m_nCoreOptions
.bBookmarks
)
388 && (bHard
|| IsFieldShadings());
391 bool IsLineBreak(bool bHard
= false) const
393 return !m_bReadonly
&& (m_nCoreOptions
.bLinebreak
) &&
394 ((m_nCoreOptions
.bViewMetachars
) || bHard
);
396 void SetLineBreak( bool b
)
398 m_nCoreOptions
.bLinebreak
= b
;
401 void SetPageBreak( bool b
)
403 m_nCoreOptions
.bPagebreak
= b
;
406 void SetColumnBreak( bool b
)
408 m_nCoreOptions
.bColumnbreak
= b
;
411 bool IsSoftHyph() const
412 { return !m_bReadonly
&& (m_nCoreOptions
.bSoftHyph
); }
414 void SetSoftHyph( bool b
)
416 m_nCoreOptions
.bSoftHyph
= b
;
419 bool IsFieldName() const
420 { return !m_bReadonly
&& (m_nCoreOptions
.bFieldName
); }
422 void SetFieldName( bool b
)
424 m_nCoreOptions
.bFieldName
= b
;
427 bool IsPostIts() const
429 return m_nCoreOptions
.bPostits
;
432 void SetPostIts( bool b
)
434 m_nCoreOptions
.bPostits
= b
;
437 bool IsResolvedPostIts() const
438 { return bool(m_nUIOptions
& ViewOptFlags2::ResolvedPostits
); }
440 void SetResolvedPostIts( bool b
)
441 { SetUIOption(b
, ViewOptFlags2::ResolvedPostits
); }
443 void PaintPostIts( OutputDevice
*pOut
, const SwRect
&rRect
,
444 bool bIsScript
) const;
445 static sal_uInt16
GetPostItsWidth( const OutputDevice
*pOut
);
447 //show/hide tooltips on tracked changes
448 bool IsShowInlineTooltips() const
450 return m_nCoreOptions
.bShowInlineTooltips
;
453 void SetShowInlineTooltips( bool b
)
454 { m_nCoreOptions
.bShowInlineTooltips
= b
; }
456 //show/hide tracked deletions in text
457 bool IsShowChangesInMargin() const
459 return m_nCoreOptions
.bShowChangesInMargin
;
462 void SetShowChangesInMargin( bool b
)
464 m_nCoreOptions
.bShowChangesInMargin
= b
;
467 //show/hide tracked insertions in text
468 bool IsShowChangesInMargin2() const
469 { return m_nCoreOptions
.bShowChangesInMargin2
; }
471 void SetShowChangesInMargin2( bool b
)
472 { m_nCoreOptions
.bShowChangesInMargin2
= b
; }
474 //show/hide interactive header/footer on top/bottom of pages
475 bool IsUseHeaderFooterMenu() const
476 { return m_nCoreOptions
.bUseHeaderFooterMenu
; }
477 void SetUseHeaderFooterMenu( bool b
)
478 { m_nCoreOptions
.bUseHeaderFooterMenu
= b
; }
480 //show/hide outline content visibility button
481 bool IsShowOutlineContentVisibilityButton() const;
482 void SetShowOutlineContentVisibilityButton(bool b
)
483 { m_nCoreOptions
.bShowOutlineContentVisibilityButton
= b
; }
485 bool IsTreatSubOutlineLevelsAsContent() const;
486 void SetTreatSubOutlineLevelsAsContent(bool b
)
487 { m_nCoreOptions
.bTreatSubOutlineLevelsAsContent
= b
; }
489 bool IsShowHiddenChar(bool bHard
= false) const
490 { return !m_bReadonly
&& m_nCoreOptions
.bCharHidden
&&
491 (m_nCoreOptions
.bViewMetachars
|| bHard
); }
493 void SetShowHiddenChar( bool b
)
494 { m_nCoreOptions
.bCharHidden
= b
; }
496 bool IsShowHiddenField() const
497 { return !m_bReadonly
&& m_nCoreOptions
.bFieldHidden
; }
498 void SetShowHiddenField( bool b
)
499 { m_nCoreOptions
.bFieldHidden
= b
; }
501 bool IsGraphic() const
502 { return m_nCoreOptions
.bGraphic
; }
503 void SetGraphic( bool b
)
504 { m_nCoreOptions
.bGraphic
= b
; }
506 bool IsPageBack() const
507 { return m_nCoreOptions
.bPageback
; }
508 void SetPageBack( bool b
)
509 { m_nCoreOptions
.bPageback
= b
; }
512 { return m_nCoreOptions
.bTable
; }
513 void SetTable( bool b
)
514 { m_nCoreOptions
.bTable
= b
; }
517 { return m_nCoreOptions
.bDraw
; }
518 void SetDraw( bool b
)
519 { m_nCoreOptions
.bDraw
= b
; }
521 bool IsControl() const
522 { return m_nCoreOptions
.bControl
; }
523 void SetControl( bool b
)
524 { m_nCoreOptions
.bControl
= b
; }
527 { return m_nCoreOptions
.bSnap
; }
528 void SetSnap( bool b
)
529 { m_nCoreOptions
.bSnap
= b
; }
531 void SetSnapSize( Size
const &rSz
){ m_aSnapSize
= rSz
; }
532 const Size
&GetSnapSize() const { return m_aSnapSize
; }
534 bool IsGridVisible() const
535 { return !m_bReadonly
&& m_nCoreOptions
.bGridVisible
; }
536 void SetGridVisible( bool b
)
537 { m_nCoreOptions
.bGridVisible
= b
; }
539 bool IsOnlineSpell() const
541 return !m_bReadonly
&& m_nCoreOptions
.bOnlineSpell
;
543 void SetOnlineSpell( bool b
)
545 m_nCoreOptions
.bOnlineSpell
= b
;
548 bool IsViewMetaChars() const
549 { return !m_bReadonly
&& m_nCoreOptions
.bViewMetachars
; }
550 void SetViewMetaChars( bool b
)
551 { m_nCoreOptions
.bViewMetachars
= b
; }
553 bool IsSynchronize() const
554 { return m_nCoreOptions
.bSynchronize
; }
555 void SetSynchronize( bool b
)
556 { m_nCoreOptions
.bSynchronize
= b
; }
558 bool IsCrossHair() const
559 { return m_nCoreOptions
.bCrosshair
; }
560 void SetCrossHair( bool b
)
561 { m_nCoreOptions
.bCrosshair
= b
; }
563 // Options from nCore2Options
564 bool IsBlackFont() const
565 {return bool(m_nCore2Options
& ViewOptCoreFlags2::BlackFont
); }
567 void SetBlackFont(bool b
)
568 { SetCore2Option(b
, ViewOptCoreFlags2::BlackFont
); }
570 bool IsShowHiddenPara() const
571 {return bool(m_nCore2Options
& ViewOptCoreFlags2::HiddenPara
); }
573 void SetShowHiddenPara(bool b
)
574 { SetCore2Option(b
, ViewOptCoreFlags2::HiddenPara
); }
576 bool IsSmoothScroll() const
577 {return bool(m_nCore2Options
& ViewOptCoreFlags2::SmoothScroll
); }
579 void SetSmoothScroll(bool b
)
580 { SetCore2Option(b
, ViewOptCoreFlags2::SmoothScroll
); }
582 bool IsCursorInProtectedArea() const
583 {return bool(m_nCore2Options
& ViewOptCoreFlags2::CursorInProt
); }
585 void SetCursorInProtectedArea(bool b
)
586 { SetCore2Option(b
, ViewOptCoreFlags2::CursorInProt
); }
588 static bool IsIgnoreProtectedArea();
590 bool IsPDFExport() const
591 {return bool(m_nCore2Options
& ViewOptCoreFlags2::PdfExport
); }
593 void SetPDFExport(bool b
)
594 { SetCore2Option(b
, ViewOptCoreFlags2::PdfExport
); }
596 bool IsPrinting() const
597 {return bool(m_nCore2Options
& ViewOptCoreFlags2::Printing
); }
599 void SetPrinting(bool b
)
600 { SetCore2Option(b
, ViewOptCoreFlags2::Printing
); }
602 void SetCore2Option(bool b
, ViewOptCoreFlags2 f
)
605 m_nCore2Options
|= f
;
607 m_nCore2Options
&= ~f
;
610 short GetDivisionX() const { return m_nDivisionX
; }
611 void SetDivisionX( short n
){ m_nDivisionX
= n
; }
612 short GetDivisionY() const { return m_nDivisionY
; }
613 void SetDivisionY( short n
){ m_nDivisionY
= n
; }
615 // Default margin left and above document: 284 twips == 5.0 mm.
616 static constexpr sal_uInt16 defDocumentBorder
= 284;
617 // Default gap between pages: 284 twips == 5.0 mm.
618 static constexpr sal_uInt16 defGapBetweenPages
= 284;
619 // Minimum edge-to-text distance: 22 twips == 0.4 mm.
620 static constexpr sal_uInt16 minGapBetweenPages
= 22;
622 sal_uInt16
GetDocumentBorder() const { return IsWhitespaceHidden() ? minGapBetweenPages
: defDocumentBorder
; }
623 sal_uInt16
GetGapBetweenPages() const { return IsWhitespaceHidden() ? minGapBetweenPages
: defGapBetweenPages
; }
625 sal_uInt8
GetPagePrevRow() const { return m_nPagePreviewRow
; }
626 void SetPagePrevRow( sal_uInt8 n
) { m_nPagePreviewRow
= n
; }
627 sal_uInt8
GetPagePrevCol() const { return m_nPagePreviewCol
; }
628 void SetPagePrevCol( sal_uInt8 n
) { m_nPagePreviewCol
= n
; }
629 bool IsReadonly() const { return m_bReadonly
; }
630 void SetReadonly(bool bSet
) { m_bReadonly
= bSet
; }
632 bool IsSelectionInReadonly() const {return m_bSelectionInReadonly
;}
633 void SetSelectionInReadonly(bool bSet
) {m_bSelectionInReadonly
= bSet
;}
635 bool IsFormView() const { return mbFormView
; }
636 void SetFormView( bool bSet
) { mbFormView
= bSet
; }
638 bool getBrowseMode() const { return mbBrowseMode
; }
639 void setBrowseMode(bool bSet
) { mbBrowseMode
= bSet
; }
640 bool IsPagePrevBookview() const { return mbBookView
; }
641 void SetPagePrevBookview(bool bSet
) { mbBookView
= bSet
; }
643 static bool IsAutoCompleteWords();
645 bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode
; }
646 void SetViewLayoutBookMode( bool bNew
) { mbViewLayoutBookMode
= bNew
; }
647 sal_uInt16
GetViewLayoutColumns() const { return mnViewLayoutColumns
; }
648 void SetViewLayoutColumns( sal_uInt16 nNew
) { mnViewLayoutColumns
= nNew
; }
649 bool IsHideWhitespaceMode() const { return mbHideWhitespaceMode
; }
650 void SetHideWhitespaceMode( bool bMode
) { mbHideWhitespaceMode
= bMode
; }
652 /// The rules that allow for hiding whitespace.
653 bool CanHideWhitespace() const { return !IsMultipageView(); }
654 bool IsWhitespaceHidden() const { return IsHideWhitespaceMode() && !IsMultipageView(); }
655 bool IsMultipageView() const { return IsViewLayoutBookMode() ||
656 GetViewLayoutColumns() == 0; }
659 // Correspond to statements in ui/config/cfgvw.src.
660 bool IsTest1() const { return m_bTest1
; }
661 bool IsTest2() const { return m_bTest2
; }
662 bool IsTest3() const { return m_bTest3
; }
663 bool IsTest4() const { return m_bTest4
; }
664 bool IsTest5() const { return m_bTest5
; }
665 bool IsTest6() const { return m_bTest6
; }
666 bool IsTest7() const { return m_bTest7
; }
667 bool IsTest8() const { return m_bTest8
; }
668 bool IsTest10() const { return m_bTest10
; }
671 sal_uInt16
GetZoom() const { return m_nZoom
; }
672 void SetZoom( sal_uInt16 n
){ m_nZoom
= n
; }
674 static void DrawRect( OutputDevice
* pOut
, const SwRect
&rRect
, ::Color nCol
);
675 static void DrawRectPrinter( OutputDevice
* pOut
, const SwRect
& rRect
);
677 SwViewOption
& operator=( const SwViewOption
&rOpt
);
680 bool IsEqualFlags ( const SwViewOption
&rOpt
) const;
681 inline bool operator == ( const SwViewOption
&rOpt
) const;
682 bool operator != ( const SwViewOption
&rOpt
) const { return !(*this == rOpt
); }
684 // Options from nUIOptions
685 bool IsViewVScrollBar() const
687 #if HAVE_FEATURE_DESKTOP
688 return bool(m_nUIOptions
& ViewOptFlags2::VScrollbar
);
693 bool IsViewHScrollBar() const
695 #if HAVE_FEATURE_DESKTOP
696 return bool(m_nUIOptions
& ViewOptFlags2::HScrollbar
);
701 bool IsKeepRatio() const
702 { return bool(m_nUIOptions
& ViewOptFlags2::KeepAspectRatio
); }
703 bool IsGrfKeepZoom() const
704 { return bool(m_nUIOptions
& ViewOptFlags2::GrfKeepZoom
); }
705 bool IsShowContentTips() const
706 { return bool(m_nUIOptions
& ViewOptFlags2::ContentTips
); }
707 bool IsPrtFormat() const
708 { return bool(m_nUIOptions
& ViewOptFlags2::PrintFormat
); }
709 bool IsShowScrollBarTips() const
710 { return bool(m_nUIOptions
& ViewOptFlags2::ScrollbarTips
); }
712 SvxZoomType
GetZoomType() const { return m_eZoom
; }
714 sal_uInt8
GetTableDest() const { return m_nTableDestination
; }
716 void SetViewVScrollBar(bool b
)
717 { SetUIOption(b
, ViewOptFlags2::VScrollbar
); }
718 void SetViewHScrollBar(bool b
)
719 { SetUIOption(b
, ViewOptFlags2::HScrollbar
); }
720 void SetKeepRatio (bool b
)
721 { SetUIOption(b
, ViewOptFlags2::KeepAspectRatio
); }
722 void SetGrfKeepZoom (bool b
)
723 { SetUIOption(b
, ViewOptFlags2::GrfKeepZoom
); }
724 void SetShowContentTips( bool b
)
725 { SetUIOption(b
, ViewOptFlags2::ContentTips
); }
726 void SetPrtFormat( bool b
)
727 { SetUIOption(b
, ViewOptFlags2::PrintFormat
); }
728 void SetShowScrollBarTips( bool b
)
729 { SetUIOption(b
, ViewOptFlags2::ScrollbarTips
); }
730 void SetUIOption( bool b
, ViewOptFlags2 f
)
738 void SetZoomType (SvxZoomType eZoom_
){ m_eZoom
= eZoom_
; }
739 void SetTableDest( sal_uInt8 nNew
) { m_nTableDestination
= nNew
; }
741 const OUString
& GetSymbolFont() const {return m_sSymbolFont
;}
742 void SetSymbolFont(const OUString
& sSet
) {m_sSymbolFont
= sSet
;}
744 const Color
& GetRetoucheColor() const { return m_aRetouchColor
;}
745 void SetRetoucheColor(const Color
&r
) { m_aRetouchColor
= r
; }
747 bool IsViewAnyRuler() const
749 #if HAVE_FEATURE_DESKTOP
750 return bool(m_nUIOptions
& ViewOptFlags2::AnyRuler
);
755 void SetViewAnyRuler(bool bSet
)
756 { SetUIOption(bSet
, ViewOptFlags2::AnyRuler
);}
758 bool IsViewHRuler(bool bDirect
= false) const
760 #if HAVE_FEATURE_DESKTOP
762 ? bool(m_nUIOptions
& ViewOptFlags2::HRuler
)
763 : !m_bReadonly
&& (m_nUIOptions
& (ViewOptFlags2::AnyRuler
|ViewOptFlags2::HRuler
)) == (ViewOptFlags2::AnyRuler
|ViewOptFlags2::HRuler
);
769 void SetViewHRuler (bool b
)
770 { SetUIOption(b
, ViewOptFlags2::HRuler
); }
772 bool IsViewVRuler(bool bDirect
= false) const
774 #if HAVE_FEATURE_DESKTOP
776 ? bool(m_nUIOptions
& ViewOptFlags2::VRuler
)
777 : !m_bReadonly
&& (m_nUIOptions
& (ViewOptFlags2::AnyRuler
|ViewOptFlags2::VRuler
)) == (ViewOptFlags2::AnyRuler
|ViewOptFlags2::VRuler
);
783 void SetViewVRuler (bool b
)
784 { SetUIOption(b
, ViewOptFlags2::VRuler
); }
786 // ShadowCursor, switch on/off, get/set color/mode.
787 bool IsShadowCursor() const
788 { return bool(m_nUIOptions
& ViewOptFlags2::ShadowCursor
); }
789 void SetShadowCursor(bool b
)
790 { SetUIOption(b
, ViewOptFlags2::ShadowCursor
); }
792 //move vertical ruler to the right
793 bool IsVRulerRight() const
794 { return bool(m_nUIOptions
& ViewOptFlags2::VRulerRight
); }
795 void SetVRulerRight(bool b
)
796 { SetUIOption(b
, ViewOptFlags2::VRulerRight
); }
798 bool IsStarOneSetting() const {return m_bStarOneSetting
; }
799 void SetStarOneSetting(bool bSet
) {m_bStarOneSetting
= bSet
; }
801 bool IsPagePreview() const {return m_bIsPagePreview
; }
802 void SetPagePreview(bool bSet
) { m_bIsPagePreview
= bSet
; }
804 SwFillMode
GetShdwCursorFillMode() const { return m_nShadowCursorFillMode
; }
805 void SetShdwCursorFillMode( SwFillMode nMode
) { m_nShadowCursorFillMode
= nMode
; };
807 bool IsShowPlaceHolderFields() const { return m_bShowPlaceHolderFields
; }
808 void SetShowPlaceHolderFields(bool bSet
) { m_bShowPlaceHolderFields
= bSet
; }
810 const Color
& GetDocColor() const;
811 const Color
& GetDocBoundariesColor() const;
812 const Color
& GetAppBackgroundColor() const;
813 const Color
& GetObjectBoundariesColor() const;
814 const Color
& GetTableBoundariesColor() const;
815 const Color
& GetIndexShadingsColor() const;
816 const Color
& GetLinksColor() const;
817 const Color
& GetVisitedLinksColor() const;
818 const Color
& GetDirectCursorColor() const;
819 const Color
& GetTextGridColor() const;
820 const Color
& GetSpellColor() const;
821 const Color
& GetGrammarColor() const;
822 const Color
& GetSmarttagColor() const;
823 const Color
& GetShadowColor() const;
824 const Color
& GetFontColor() const;
825 const Color
& GetFieldShadingsColor() const;
826 const Color
& GetSectionBoundColor() const;
827 const Color
& GetPageBreakColor() const;
828 const Color
& GetHeaderFooterMarkColor() const;
830 bool IsAppearanceFlag(ViewOptFlags nFlag
) const;
832 bool IsDocBoundaries() const {return IsAppearanceFlag(ViewOptFlags::DocBoundaries
);}
833 bool IsObjectBoundaries() const {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries
);}
834 bool IsTableBoundaries() const {return IsAppearanceFlag(ViewOptFlags::TableBoundaries
);}
835 bool IsIndexShadings() const {return IsAppearanceFlag(ViewOptFlags::IndexShadings
);}
836 bool IsLinks() const {return IsAppearanceFlag(ViewOptFlags::Links
);}
837 bool IsVisitedLinks() const {return IsAppearanceFlag(ViewOptFlags::VisitedLinks
);}
838 bool IsFieldShadings() const {return IsAppearanceFlag(ViewOptFlags::FieldShadings
);}
839 bool IsSectionBoundaries() const {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries
);}
840 bool IsShadow() const {return IsAppearanceFlag(ViewOptFlags::Shadow
);}
842 void SetAppearanceFlag(ViewOptFlags nFlag
, bool bSet
, bool bSaveInConfig
= false);
844 void SetDocBoundaries(bool bSet
) {SetAppearanceFlag(ViewOptFlags::DocBoundaries
, bSet
);}
846 // get/set default anchor (0..2); use GetDefaultAnchorType() to convert into RndStdIds::FLY_*
847 sal_Int32
GetDefaultAnchor() const
848 { return m_nDefaultAnchor
; }
849 void SetDefaultAnchor( const sal_Int32 aFlag
)
850 { m_nDefaultAnchor
= aFlag
; }
852 RndStdIds
GetDefaultAnchorType() const;
854 // Useful for when getting the current view SwViewOption is not possible otherwise
855 static const SwViewOption
& GetCurrentViewOptions();
858 inline bool SwViewOption::operator==( const SwViewOption
&rOpt
) const
860 return IsEqualFlags( rOpt
) && m_nZoom
== rOpt
.GetZoom() && m_aColorConfig
== rOpt
.m_aColorConfig
;
863 inline void SwViewOption::SetUIOptions( const SwViewOption
& rVOpt
)
865 m_nUIOptions
= rVOpt
.m_nUIOptions
;
866 m_nTableDestination
= rVOpt
.m_nTableDestination
;
867 m_nShadowCursorFillMode
= rVOpt
.m_nShadowCursorFillMode
;
870 // Helper function for checking HTML-capabilities.
871 SW_DLLPUBLIC sal_uInt16
GetHtmlMode(const SwDocShell
*);
875 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */