summaryrefslogtreecommitdiff
path: root/sw/inc/viewopt.hxx
blob: 996aec4848c21821d5cdc7cbed4be1702a29e520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_SW_INC_VIEWOPT_HXX
#define INCLUDED_SW_INC_VIEWOPT_HXX

#include <config_feature_desktop.h>

#include <tools/gen.hxx>
#include <tools/color.hxx>

#include <svx/swframetypes.hxx>
#include <sfx2/zoomitem.hxx>
#include "swdllapi.h"

class SwRect;
namespace vcl { class Window; }
class OutputDevice;
class SwDocShell;
namespace svtools{ class ColorConfig;}
enum class SwFillMode;

enum class ViewOptFlags1 : sal_uInt64 {
    UseHeaderFooterMenu = 0x00000001,
    Tab           = 0x00000002,
    Blank         = 0x00000004,
    HardBlank     = 0x00000008,
    Paragraph     = 0x00000010,
    Linebreak     = 0x00000020,
    Pagebreak     = 0x00000040,
    Columnbreak   = 0x00000080,
    SoftHyph      = 0x00000100,
    Bookmarks     = 0x00000200,
    Ref           = 0x00000400,
    FieldName     = 0x00000800,
    Postits       = 0x00004000,
    FieldHidden   = 0x00008000,
    CharHidden    = 0x00010000,
    Graphic       = 0x00020000,
    Table         = 0x00040000,
    Draw          = 0x00080000,
    Control       = 0x00100000,
    Crosshair     = 0x00400000,
    Snap          = 0x00800000,
    Synchronize   = 0x01000000,
    GridVisible   = 0x02000000,
    OnlineSpell   = 0x04000000,
    TreatSubOutlineLevelsAsContent = 0x08000000,
    ShowInlineTooltips = 0x10000000, //tooltips on tracked changes
    ViewMetachars = 0x20000000,
    Pageback      = 0x40000000,
    ShowOutlineContentVisibilityButton = 0x80000000,
    ShowChangesInMargin = 0x100000000 //tracked deletions in margin
};
namespace o3tl {
    template<> struct typed_flags<ViewOptFlags1> : is_typed_flags<ViewOptFlags1, 0x1ffdfcfff> {};
}

enum class ViewOptCoreFlags2 {
    BlackFont         = 0x0001,
    HiddenPara        = 0x0002,
    SmoothScroll      = 0x0004,
    CursorInProt      = 0x0008,
    PdfExport         = 0x0010,
    Printing          = 0x0020,
};
namespace o3tl {
    template<> struct typed_flags<ViewOptCoreFlags2> : is_typed_flags<ViewOptCoreFlags2, 0x003f> {};
};

enum class ViewOptFlags2 {
    HRuler          = 0x00000400,
    VScrollbar      = 0x00000800,
    HScrollbar      = 0x00001000,
    VRuler          = 0x00004000,
    AnyRuler        = 0x00008000,
    Modified        = 0x00010000,
    KeepAspectRatio = 0x00020000,
    GrfKeepZoom     = 0x00040000,
    ContentTips     = 0x00100000,
    ScrollbarTips   = 0x00400000,
    PrintFormat     = 0x00800000,
    ShadowCursor    = 0x01000000,
    VRulerRight     = 0x02000000,
    ResolvedPostits = 0x04000000,
};
namespace o3tl {
    template<> struct typed_flags<ViewOptFlags2> : is_typed_flags<ViewOptFlags2, 0x07d7dc00> {};
};

// Table background.
#define TBL_DEST_CELL   0
#define TBL_DEST_ROW    1
#define TBL_DEST_TBL    2

// Appearance flags.
enum class ViewOptFlags {
    NONE               = 0x0000,
    DocBoundaries      = 0x0001,
    ObjectBoundaries   = 0x0002,
    TableBoundaries    = 0x0004,
    IndexShadings      = 0x0008,
    Links              = 0x0010,
    VisitedLinks       = 0x0020,
    FieldShadings      = 0x0040,
    SectionBoundaries  = 0x0080,
    Shadow             = 0x0100,
};
namespace o3tl {
    template<> struct typed_flags<ViewOptFlags> : is_typed_flags<ViewOptFlags, 0x01ff> {};
}

class SW_DLLPUBLIC SwViewOption
{
    static Color    s_aDocColor;  // color of document boundaries
    static Color    s_aDocBoundColor;  // color of document boundaries
    static Color    s_aObjectBoundColor; // color of object boundaries
    static Color    s_aAppBackgroundColor; // application background
    static Color    s_aTableBoundColor; // color of table boundaries
    static Color    s_aFontColor;
    static Color    s_aIndexShadingsColor; // background color of indexes
    static Color    s_aLinksColor;
    static Color    s_aVisitedLinksColor;
    static Color    s_aDirectCursorColor;
    static Color    s_aTextGridColor;
    static Color    s_aSpellColor;     // mark color of online spell checking
    static Color    s_aSmarttagColor;
    static Color    s_aFieldShadingsColor;
    static Color    s_aSectionBoundColor;
    static Color    s_aPageBreakColor;
    static Color    s_aScriptIndicatorColor;
    static Color    s_aShadowColor;
    static Color    s_aHeaderFooterMarkColor;

    static ViewOptFlags s_nAppearanceFlags;
    static sal_uInt16   s_nPixelTwips;// 1 Pixel == ? Twips

    OUString        m_sSymbolFont;        // Symbolfont.
    ViewOptFlags1   m_nCoreOptions;       // Bits for SwViewShell.
    ViewOptCoreFlags2 m_nCore2Options;    // Bits for SwViewShell.
    ViewOptFlags2   m_nUIOptions;         // UI-Bits
    Color           m_aRetouchColor;      // DefaultBackground for BrowseView
    Size            m_aSnapSize;          // Describes horizontal and vertical snap.
    sal_uInt16      mnViewLayoutColumns;  // # columns for edit view
    short           m_nDivisionX;         // Grid division.
    short           m_nDivisionY;
    sal_uInt8       m_nPagePreviewRow;       // Page Preview Row/Columns.
    sal_uInt8       m_nPagePreviewCol;       // Page Preview Row/Columns.
    SwFillMode      m_nShadowCursorFillMode;  // FillMode for ShadowCursor.
    bool            m_bReadonly : 1;      // Readonly-Doc.
    bool            m_bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
    bool            m_bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
    bool            m_bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents.
    bool            mbFormView : 1;
    bool            mbBrowseMode : 1;
    bool            mbBookView : 1;      // View mode for page preview.
    bool            mbViewLayoutBookMode : 1; // Book view mode for edit view.
    bool            mbHideWhitespaceMode : 1; // Hide header, footer, and pagebreak.
    bool            m_bShowPlaceHolderFields : 1; // Only used in printing!
    mutable bool    m_bIdle;
    sal_Int32       m_nDefaultAnchor;     // GetDefaultAnchorType() to convert int to RndStdIds

    // Scale
    sal_uInt16          m_nZoom;          // In percent.
    SvxZoomType     m_eZoom;              // 'enum' for zoom.

    sal_uInt8            m_nTableDestination;      // Destination for table background.

#ifdef DBG_UTIL
    // Corresponds to statements in ui/config/cfgvw.src.
    bool  m_bTest1        :1;     // Test-flag  "Layout not loading"
    bool  m_bTest2        :1;     // Test-flag  "WYSIWYG++"
    bool  m_bTest3        :1;     // Test-flag  ""
    bool  m_bTest4        :1;     // Test-flag  "WYSIWYG debug"
    bool  m_bTest5        :1;     // Test-flag  "No idle format"
    bool  m_bTest6        :1;     // Test-flag  "No screen adj"
    bool  m_bTest7        :1;     // Test-flag  "win format"
    bool  m_bTest8        :1;     // Test-flag  ""
    bool  m_bTest10       :1;     // Test-Flag  "Format by Input"
#endif

public:
            SwViewOption();                     // CTOR
            SwViewOption(const SwViewOption&);
            ~SwViewOption();

    static void Init( vcl::Window const *pWin );        // Initializing of static data.

    ViewOptFlags1   GetCoreOptions() const {return m_nCoreOptions;}
    inline void     SetUIOptions( const SwViewOption& );

    // Options from nCoreOptions
    bool IsIdle() const
        { return m_bIdle; }

    // Logically this is a const function since it does not modify the viewoptions
    // but only effects idle formatting. Of course that member is already implement
    // in the wrong place here... Also currently there are many const modifying casts in the code
    // just to call this function on otherwise const objects. Thus declaring it as const now.
    void SetIdle( bool b ) const
        { m_bIdle = b; }

    bool IsTab(bool bHard = false) const
                    {   return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Tab) &&
                            ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
    void SetTab( bool b )
        { SetCoreOption(b, ViewOptFlags1::Tab); }

    bool IsBlank(bool bHard = false) const
                    { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Blank) &&
                            ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
    void SetBlank( bool b )
        { SetCoreOption(b, ViewOptFlags1::Blank); }

    bool IsHardBlank() const
                    { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::HardBlank); }
    void SetHardBlank( bool b )
        { SetCoreOption(b, ViewOptFlags1::HardBlank); }

    bool IsParagraph(bool bHard = false) const
                    {   return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Paragraph) &&
                            ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
    void SetParagraph( bool b )
        { SetCoreOption(b, ViewOptFlags1::Paragraph); }

    void SetShowBookmarks(bool const b)
    {
        SetCoreOption(b, ViewOptFlags1::Bookmarks);
    }
    bool IsShowBookmarks(bool const bHard = false) const
    {
        return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Bookmarks)
                && (bHard || (m_nCoreOptions & ViewOptFlags1::ViewMetachars));
    }

    bool IsLineBreak(bool bHard = false) const
                    {   return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::Linebreak) &&
                            ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }
    void SetLineBreak( bool b )
        { SetCoreOption(b, ViewOptFlags1::Linebreak); }

    void SetPageBreak( bool b )
        { SetCoreOption(b, ViewOptFlags1::Pagebreak); }

    void SetColumnBreak( bool b)
        { SetCoreOption(b, ViewOptFlags1::Columnbreak); }

    bool IsSoftHyph() const
                    { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::SoftHyph); }
    void SetSoftHyph( bool b )
        { SetCoreOption(b, ViewOptFlags1::SoftHyph); }

    bool IsFieldName() const       { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldName); }
    void SetFieldName( bool b )
        { SetCoreOption(b, ViewOptFlags1::FieldName); }

    bool IsPostIts() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Postits); }
    void SetPostIts( bool b )
        { SetCoreOption(b, ViewOptFlags1::Postits); }

    bool IsResolvedPostIts() const
        { return bool(m_nUIOptions & ViewOptFlags2::ResolvedPostits); }
    void SetResolvedPostIts( bool b )
        { SetUIOption(b, ViewOptFlags2::ResolvedPostits); }

    static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
                              bool bIsScript );
    static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut );

    //show/hide tooltips on tracked changes
    bool IsShowInlineTooltips() const
        { return bool(m_nCoreOptions & ViewOptFlags1::ShowInlineTooltips); }
    void SetShowInlineTooltips( bool b )
        { SetCoreOption(b, ViewOptFlags1::ShowInlineTooltips); }

    //show/hide tracked deletions in text
    bool IsShowChangesInMargin() const
        { return bool(m_nCoreOptions & ViewOptFlags1::ShowChangesInMargin); }
    void SetShowChangesInMargin( bool b )
        { SetCoreOption(b, ViewOptFlags1::ShowChangesInMargin); }

    //show/hide interactive header/footer on top/bottom of pages
    bool IsUseHeaderFooterMenu() const
        { return bool(m_nCoreOptions & ViewOptFlags1::UseHeaderFooterMenu ); }
    void SetUseHeaderFooterMenu( bool b )
        { SetCoreOption(b, ViewOptFlags1::UseHeaderFooterMenu); }

    //show/hide outline content visibility button
    bool IsShowOutlineContentVisibilityButton() const;
    void SetShowOutlineContentVisibilityButton(bool b)
        { SetCoreOption(b, ViewOptFlags1::ShowOutlineContentVisibilityButton); }

    bool IsTreatSubOutlineLevelsAsContent() const;
    void SetTreatSubOutlineLevelsAsContent(bool b)
        { SetCoreOption(b, ViewOptFlags1::TreatSubOutlineLevelsAsContent); }


    bool IsShowHiddenChar(bool bHard = false) const
        { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::CharHidden) &&
                            ((m_nCoreOptions & ViewOptFlags1::ViewMetachars)||bHard); }

    void SetShowHiddenChar( bool b )
        { SetCoreOption(b, ViewOptFlags1::CharHidden); }

    bool IsShowHiddenField() const
        { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::FieldHidden); }
    void SetShowHiddenField( bool b )
        { SetCoreOption(b, ViewOptFlags1::FieldHidden); }

    bool IsGraphic() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Graphic); }
    void SetGraphic( bool b )
        { SetCoreOption(b, ViewOptFlags1::Graphic); }

    bool IsPageBack() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Pageback); }
    void SetPageBack( bool b )
        { SetCoreOption(b, ViewOptFlags1::Pageback); }

    bool IsTable() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Table); }
    void SetTable( bool b )
        { SetCoreOption(b, ViewOptFlags1::Table); }

    bool IsDraw() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Draw); }
    void SetDraw( bool b )
        { SetCoreOption(b, ViewOptFlags1::Draw); }

    bool IsControl() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Control); }
    void SetControl( bool b )
        { SetCoreOption(b, ViewOptFlags1::Control); }

    bool IsSnap() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Snap); }
    void SetSnap( bool b )
        { SetCoreOption(b, ViewOptFlags1::Snap); }

    void SetSnapSize( Size const &rSz ){ m_aSnapSize = rSz; }
    const Size &GetSnapSize() const { return m_aSnapSize; }

    bool IsGridVisible() const
        { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::GridVisible); }
    void SetGridVisible( bool b )
        { SetCoreOption(b, ViewOptFlags1::GridVisible); }

    bool IsOnlineSpell() const
        { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::OnlineSpell); }
    void SetOnlineSpell( bool b );

    bool IsViewMetaChars() const
        { return !m_bReadonly && (m_nCoreOptions & ViewOptFlags1::ViewMetachars); }
    void SetViewMetaChars( bool b)
        { SetCoreOption(b, ViewOptFlags1::ViewMetachars); }

    bool IsSynchronize() const
        {  return bool(m_nCoreOptions & ViewOptFlags1::Synchronize); }
    void SetSynchronize( bool b )
        { SetCoreOption(b, ViewOptFlags1::Synchronize); }

    bool IsCrossHair() const
        { return bool(m_nCoreOptions & ViewOptFlags1::Crosshair); }
    void SetCrossHair( bool b )
        { SetCoreOption(b, ViewOptFlags1::Crosshair); }

    // Options from nCore2Options
    bool IsBlackFont() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::BlackFont); }

    void SetBlackFont(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::BlackFont); }

    bool IsShowHiddenPara() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::HiddenPara); }

    void SetShowHiddenPara(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::HiddenPara); }

    bool IsSmoothScroll() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::SmoothScroll); }

    void SetSmoothScroll(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::SmoothScroll); }

    bool IsCursorInProtectedArea() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::CursorInProt); }

    void SetCursorInProtectedArea(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::CursorInProt); }

    static bool IsIgnoreProtectedArea();

    bool IsPDFExport() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::PdfExport); }

    void SetPDFExport(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::PdfExport); }

    bool IsPrinting() const
        {return bool(m_nCore2Options & ViewOptCoreFlags2::Printing); }

    void SetPrinting(bool b)
        { SetCore2Option(b, ViewOptCoreFlags2::Printing); }

    void SetCore2Option(bool b, ViewOptCoreFlags2 f)
    {
        if (b)
            m_nCore2Options |= f;
        else
            m_nCore2Options &= ~f;
    }
    void SetCoreOption(bool b, ViewOptFlags1 f)
    {
        if (b)
            m_nCoreOptions |= f;
        else
            m_nCoreOptions &= ~f;
    }

    short GetDivisionX() const   { return m_nDivisionX; }
    void  SetDivisionX( short n ){ m_nDivisionX = n; }
    short GetDivisionY() const   { return m_nDivisionY; }
    void  SetDivisionY( short n ){ m_nDivisionY = n; }

    // Default margin left and above document: 284 twips == 5.0 mm.
    static constexpr sal_uInt16 defDocumentBorder = 284;
    // Default gap between pages: 284 twips == 5.0 mm.
    static constexpr sal_uInt16 defGapBetweenPages = 284;
    // Minimum edge-to-text distance: 22 twips == 0.4 mm.
    static constexpr sal_uInt16 minGapBetweenPages = 22;

    sal_uInt16 GetDocumentBorder() const { return IsWhitespaceHidden() ? minGapBetweenPages : defDocumentBorder; }
    sal_uInt16 GetGapBetweenPages() const { return IsWhitespaceHidden() ? minGapBetweenPages : defGapBetweenPages; }

    sal_uInt8  GetPagePrevRow() const      { return m_nPagePreviewRow; }
    void  SetPagePrevRow( sal_uInt8 n ) { m_nPagePreviewRow = n; }
    sal_uInt8  GetPagePrevCol() const      { return m_nPagePreviewCol; }
    void  SetPagePrevCol( sal_uInt8 n ) { m_nPagePreviewCol = n; }
    bool         IsReadonly() const { return m_bReadonly; }
    void         SetReadonly(bool bSet) { m_bReadonly = bSet; }

    bool         IsSelectionInReadonly() const {return m_bSelectionInReadonly;}
    void         SetSelectionInReadonly(bool bSet) {m_bSelectionInReadonly = bSet;}

    bool         IsFormView() const { return mbFormView; }
    void         SetFormView( bool bSet ) { mbFormView = bSet; }

    bool  getBrowseMode() const { return mbBrowseMode; }
    void  setBrowseMode(bool bSet) { mbBrowseMode = bSet; }
    bool  IsPagePrevBookview() const { return mbBookView; }
    void  SetPagePrevBookview(bool bSet) { mbBookView = bSet; }

    static bool IsAutoCompleteWords();

    bool   IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
    void   SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
    sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
    void   SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
    bool   IsHideWhitespaceMode() const { return mbHideWhitespaceMode; }
    void   SetHideWhitespaceMode( bool bMode ) { mbHideWhitespaceMode = bMode; }

    /// The rules that allow for hiding whitespace.
    bool   CanHideWhitespace() const { return !IsMultipageView(); }
    bool   IsWhitespaceHidden() const { return IsHideWhitespaceMode() && !IsMultipageView(); }
    bool   IsMultipageView() const { return IsViewLayoutBookMode() ||
                                            GetViewLayoutColumns() == 0; }

#ifdef DBG_UTIL
    // Correspond to statements in ui/config/cfgvw.src.
    bool IsTest1() const     { return m_bTest1; }
    bool IsTest2() const     { return m_bTest2; }
    bool IsTest3() const     { return m_bTest3; }
    bool IsTest4() const     { return m_bTest4; }
    bool IsTest5() const     { return m_bTest5; }
    bool IsTest6() const     { return m_bTest6; }
    bool IsTest7() const     { return m_bTest7; }
    bool IsTest8() const     { return m_bTest8; }
    bool IsTest10() const    { return m_bTest10; }
#endif

    sal_uInt16 GetZoom() const    { return m_nZoom; }
    void   SetZoom( sal_uInt16 n ){ m_nZoom = n; }

    static void DrawRect( OutputDevice* pOut, const SwRect &rRect, ::Color nCol );
    static void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect );

    SwViewOption& operator=( const SwViewOption &rOpt );

    // Compare methods.
    bool IsEqualFlags ( const SwViewOption &rOpt ) const;
    inline bool operator == ( const SwViewOption &rOpt ) const;
    bool operator != ( const SwViewOption &rOpt ) const  { return !(*this == rOpt); }

    // Options from nUIOptions
    bool    IsViewVScrollBar() const
        {
#if HAVE_FEATURE_DESKTOP
            return bool(m_nUIOptions & ViewOptFlags2::VScrollbar);
#else
            return false;
#endif
        }
    bool    IsViewHScrollBar() const
        {
#if HAVE_FEATURE_DESKTOP
            return bool(m_nUIOptions & ViewOptFlags2::HScrollbar);
#else
            return false;
#endif
        }
    bool    IsKeepRatio()      const
        { return bool(m_nUIOptions & ViewOptFlags2::KeepAspectRatio); }
    bool    IsGrfKeepZoom()    const
        { return bool(m_nUIOptions & ViewOptFlags2::GrfKeepZoom); }
    bool    IsShowContentTips() const
        { return bool(m_nUIOptions & ViewOptFlags2::ContentTips); }
    bool    IsPrtFormat() const
        { return bool(m_nUIOptions & ViewOptFlags2::PrintFormat); }
    bool    IsShowScrollBarTips() const
        { return bool(m_nUIOptions & ViewOptFlags2::ScrollbarTips); }

    SvxZoomType    GetZoomType()      const { return m_eZoom; }

    sal_uInt8   GetTableDest() const    { return m_nTableDestination; }

    void   SetViewVScrollBar(bool b)
        { SetUIOption(b, ViewOptFlags2::VScrollbar); }
    void   SetViewHScrollBar(bool b)
        { SetUIOption(b, ViewOptFlags2::HScrollbar); }
    void   SetKeepRatio     (bool b)
        { SetUIOption(b, ViewOptFlags2::KeepAspectRatio); }
    void   SetGrfKeepZoom   (bool b)
        { SetUIOption(b, ViewOptFlags2::GrfKeepZoom); }
    void SetShowContentTips( bool b)
        { SetUIOption(b, ViewOptFlags2::ContentTips); }
    void SetPrtFormat( bool b)
        { SetUIOption(b, ViewOptFlags2::PrintFormat); }
    void SetShowScrollBarTips( bool b)
        { SetUIOption(b, ViewOptFlags2::ScrollbarTips); }
    void SetUIOption( bool b, ViewOptFlags2 f)
    {
        if (b)
            m_nUIOptions |= f;
        else
            m_nUIOptions &= ~f;
    }

    void            SetZoomType     (SvxZoomType eZoom_){ m_eZoom = eZoom_;  }
    void            SetTableDest( sal_uInt8 nNew )    { m_nTableDestination = nNew;  }

    const OUString& GetSymbolFont() const {return m_sSymbolFont;}
    void            SetSymbolFont(const OUString& sSet) {m_sSymbolFont = sSet;}

    const Color&    GetRetoucheColor() const        { return m_aRetouchColor;}
    void            SetRetoucheColor(const Color&r) { m_aRetouchColor = r;   }

    bool        IsViewAnyRuler() const
        {
#if HAVE_FEATURE_DESKTOP
            return bool(m_nUIOptions & ViewOptFlags2::AnyRuler);
#else
            return false;
#endif
        }
    void            SetViewAnyRuler(bool bSet)
                        { SetUIOption(bSet, ViewOptFlags2::AnyRuler);}

    bool        IsViewHRuler(bool bDirect = false)     const
                        {
#if HAVE_FEATURE_DESKTOP
                            return bDirect
                                   ? bool(m_nUIOptions & ViewOptFlags2::HRuler)
                                   : !m_bReadonly && (m_nUIOptions & (ViewOptFlags2::AnyRuler|ViewOptFlags2::HRuler)) == (ViewOptFlags2::AnyRuler|ViewOptFlags2::HRuler);
#else
                            (void) bDirect;
                            return false;
#endif
                        }
    void            SetViewHRuler   (bool b)
                        { SetUIOption(b, ViewOptFlags2::HRuler ); }

    bool            IsViewVRuler(bool bDirect = false) const
                        {
#if HAVE_FEATURE_DESKTOP
                            return bDirect
                                   ? bool(m_nUIOptions & ViewOptFlags2::VRuler)
                                   : !m_bReadonly && (m_nUIOptions & (ViewOptFlags2::AnyRuler|ViewOptFlags2::VRuler)) == (ViewOptFlags2::AnyRuler|ViewOptFlags2::VRuler);
#else
                            (void) bDirect;
                            return false;
#endif
                        }
    void            SetViewVRuler     (bool b)
                        { SetUIOption(b, ViewOptFlags2::VRuler); }

    // ShadowCursor, switch on/off, get/set color/mode.
    bool    IsShadowCursor()    const
        { return bool(m_nUIOptions & ViewOptFlags2::ShadowCursor); }
    void   SetShadowCursor(bool b)
        { SetUIOption(b, ViewOptFlags2::ShadowCursor); }

    //move vertical ruler to the right
    bool    IsVRulerRight()    const
        { return bool(m_nUIOptions & ViewOptFlags2::VRulerRight); }
    void   SetVRulerRight(bool b)
        { SetUIOption(b, ViewOptFlags2::VRulerRight); }

    bool            IsStarOneSetting() const {return m_bStarOneSetting; }
    void            SetStarOneSetting(bool bSet) {m_bStarOneSetting = bSet; }

    bool            IsPagePreview() const {return m_bIsPagePreview; }
    void            SetPagePreview(bool bSet) { m_bIsPagePreview= bSet; }

    SwFillMode      GetShdwCursorFillMode() const { return m_nShadowCursorFillMode; }
    void            SetShdwCursorFillMode( SwFillMode nMode ) { m_nShadowCursorFillMode = nMode; };

    bool        IsShowPlaceHolderFields() const { return m_bShowPlaceHolderFields; }
    void            SetShowPlaceHolderFields(bool bSet) { m_bShowPlaceHolderFields = bSet; }

    static Color&   GetDocColor();
    static Color&   GetDocBoundariesColor();
    static Color&   GetAppBackgroundColor();
    static Color&   GetObjectBoundariesColor();
    static Color&   GetTableBoundariesColor();
    static Color&   GetIndexShadingsColor();
    static Color&   GetLinksColor();
    static Color&   GetVisitedLinksColor();
    static Color&   GetDirectCursorColor();
    static Color&   GetTextGridColor();
    static Color&   GetSpellColor();
    static Color&   GetSmarttagColor();
    static Color&   GetShadowColor();
    static Color&   GetFontColor();
    static Color&   GetFieldShadingsColor();
    static Color&   GetSectionBoundColor();
    static Color&   GetPageBreakColor();
    static Color&   GetHeaderFooterMarkColor();

    static bool     IsAppearanceFlag(ViewOptFlags nFlag);

    static bool     IsDocBoundaries()     {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);}
    static bool     IsObjectBoundaries()  {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);}
    static bool     IsTableBoundaries()   {return IsAppearanceFlag(ViewOptFlags::TableBoundaries );}
    static bool     IsIndexShadings()     {return IsAppearanceFlag(ViewOptFlags::IndexShadings   );}
    static bool     IsLinks()             {return IsAppearanceFlag(ViewOptFlags::Links            );}
    static bool     IsVisitedLinks()      {return IsAppearanceFlag(ViewOptFlags::VisitedLinks    );}
    static bool     IsFieldShadings()     {return IsAppearanceFlag(ViewOptFlags::FieldShadings);}
    static bool     IsSectionBoundaries() {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);}
    static bool     IsShadow()            {return IsAppearanceFlag(ViewOptFlags::Shadow           );}

    static void     SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false);

    static void     SetDocBoundaries(bool bSet)   {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);}

    static void     ApplyColorConfigValues(const svtools::ColorConfig& rConfig);

    // get/set default anchor (0..2); use GetDefaultAnchorType() to convert into RndStdIds::FLY_*
    sal_Int32 GetDefaultAnchor() const
        {   return m_nDefaultAnchor; }
    void SetDefaultAnchor( const sal_Int32 aFlag )
        { m_nDefaultAnchor = aFlag; }

    RndStdIds GetDefaultAnchorType();
};

inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
{
    return IsEqualFlags( rOpt ) && m_nZoom == rOpt.GetZoom();
}

inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
{
    m_nUIOptions = rVOpt.m_nUIOptions;
    m_nTableDestination = rVOpt.m_nTableDestination;
    m_nShadowCursorFillMode = rVOpt.m_nShadowCursorFillMode;
}

// Helper function for checking HTML-capabilities.
SW_DLLPUBLIC sal_uInt16     GetHtmlMode(const SwDocShell*);

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */