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 .
23 #include <config_features.h>
25 #include <tools/gen.hxx>
26 #include <tools/string.hxx>
27 #include <tools/color.hxx>
29 #include <sfx2/zoomitem.hxx>
30 #include <svx/svxids.hrc>
32 #include "authratr.hxx"
39 namespace svtools
{ class ColorConfig
;}
41 #define VIEWOPT_1_TAB 0x00000002L
42 #define VIEWOPT_1_BLANK 0x00000004L
43 #define VIEWOPT_1_HARDBLANK 0x00000008L
44 #define VIEWOPT_1_PARAGRAPH 0x00000010L
45 #define VIEWOPT_1_LINEBREAK 0x00000020L
46 #define VIEWOPT_1_PAGEBREAK 0x00000040L
47 #define VIEWOPT_1_COLUMNBREAK 0x00000080L
48 #define VIEWOPT_1_SOFTHYPH 0x00000100L
50 #define VIEWOPT_1_REF 0x00000400L
51 #define VIEWOPT_1_FLDNAME 0x00000800L
52 #define VIEWOPT_1_POSTITS 0x00004000L
53 #define VIEWOPT_1_FLD_HIDDEN 0x00008000L
54 #define VIEWOPT_1_CHAR_HIDDEN 0x00010000L
55 #define VIEWOPT_1_GRAPHIC 0x00020000L
56 #define VIEWOPT_1_TABLE 0x00040000L
57 #define VIEWOPT_1_DRAW 0x00080000L
58 #define VIEWOPT_1_CONTROL 0x00100000L
59 #define VIEWOPT_1_CROSSHAIR 0x00400000L
60 #define VIEWOPT_1_SNAP 0x00800000L
61 #define VIEWOPT_1_SYNCHRONIZE 0x01000000L
62 #define VIEWOPT_1_GRIDVISIBLE 0x02000000L
63 #define VIEWOPT_1_ONLINESPELL 0x04000000L
64 #define VIEWOPT_1_RESERVED1 0x10000000L
65 #define VIEWOPT_1_VIEWMETACHARS 0x20000000L
66 #define VIEWOPT_1_PAGEBACK 0x40000000L
68 #define VIEWOPT_CORE2_BLACKFONT 0x00000001L
69 #define VIEWOPT_CORE2_HIDDENPARA 0x00000002L
70 #define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L
71 #define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L
72 #define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L
73 #define VIEWOPT_CORE2_PRINTING 0x00000020L
75 #define VIEWOPT_2_UNUSED1 0x00000100L
76 #define VIEWOPT_2_UNUSED2 0x00000200L
77 #define VIEWOPT_2_H_RULER 0x00000400L
78 #define VIEWOPT_2_VSCROLLBAR 0x00000800L
79 #define VIEWOPT_2_HSCROLLBAR 0x00001000L
80 #define VIEWOPT_2_STATUSLINE 0x00002000L
81 #define VIEWOPT_2_V_RULER 0x00004000L
82 #define VIEWOPT_2_ANY_RULER 0x00008000L
83 #define VIEWOPT_2_MODIFIED 0x00010000L
84 #define VIEWOPT_2_KEEPASPECTRATIO 0x00020000L
85 #define VIEWOPT_2_GRFKEEPZOOM 0x00040000L
86 #define VIEWOPT_2_CONTENT_TIPS 0x00100000L
87 #define VIEWOPT_2_RESERVED3 0x00200000L
88 #define VIEWOPT_2_RESERVED4 0x00400000L
89 #define VIEWOPT_2_PRTFORMAT 0x00800000L
90 #define VIEWOPT_2_SHADOWCRSR 0x01000000L
91 #define VIEWOPT_2_V_RULER_RIGHT 0x02000000L
95 #define TBL_DEST_CELL 0
96 #define TBL_DEST_ROW 1
97 #define TBL_DEST_TBL 2
100 #define VIEWOPT_DOC_BOUNDARIES 0x0001
101 #define VIEWOPT_OBJECT_BOUNDARIES 0x0002
102 #define VIEWOPT_TABLE_BOUNDARIES 0x0004
103 #define VIEWOPT_INDEX_SHADINGS 0x0008
104 #define VIEWOPT_LINKS 0x0010
105 #define VIEWOPT_VISITED_LINKS 0x0020
106 #define VIEWOPT_FIELD_SHADINGS 0x0040
107 #define VIEWOPT_SECTION_BOUNDARIES 0x0080
108 #define VIEWOPT_SHADOW 0x0100
110 // Implementation in core/text/txtpaint.cxx.
111 extern void SyncVout( const OutputDevice
*pOut
);
115 static Color aDocColor
; // color of document boundaries
116 static Color aDocBoundColor
; // color of document boundaries
117 static Color aObjectBoundColor
; // color of object boundaries
118 static Color aAppBackgroundColor
; // application background
119 static Color aTableBoundColor
; // color of table boundaries
120 static Color aFontColor
;
121 static Color aIndexShadingsColor
; // background color of indexes
122 static Color aLinksColor
;
123 static Color aVisitedLinksColor
;
124 static Color aDirectCursorColor
;
125 static Color aTextGridColor
;
126 static Color aSpellColor
; // mark color of online spell checking
127 static Color aSmarttagColor
;
128 static Color aFieldShadingsColor
;
129 static Color aSectionBoundColor
;
130 static Color aPageBreakColor
;
131 static Color aScriptIndicatorColor
;
132 static Color aShadowColor
;
133 static Color aHeaderFooterMarkColor
;
135 static sal_Int32 nAppearanceFlags
;
137 static sal_uInt16 nPixelTwips
;// 1 Pixel == ? Twips
139 OUString sSymbolFont
; // Symbolfont.
140 sal_uInt32 nCoreOptions
; // Bits for ViewShell.
141 sal_uInt32 nCore2Options
; // Bits for ViewShell.
142 sal_uInt32 nUIOptions
; // UI-Bits
143 Color aRetoucheColor
; // DefaultBackground for BrowseView
144 Size aSnapSize
; // Describes horizontal and vertical snap.
145 sal_uInt16 mnViewLayoutColumns
;// # columns for edit view
146 short nDivisionX
; // Grid division.
148 sal_uInt8 nPagePrevRow
; // Page Preview Row/Columns.
149 sal_uInt8 nPagePrevCol
; // Page Preview Row/Columns.
150 sal_uInt8 nShdwCrsrFillMode
; // FillMode for ShadowCrsr.
151 sal_Bool bReadonly
: 1; // Readonly-Doc.
152 sal_Bool bStarOneSetting
: 1;// Prevent from UI automatics (no scrollbars in readonly documents).
153 sal_Bool bIsPagePreview
: 1; // The preview mustn't print field/footnote/... shadings.
154 sal_Bool bSelectionInReadonly
: 1; // Determines whether selection is switched on in readonly documents.
155 sal_Bool mbFormView
: 1;
156 sal_Bool mbBrowseMode
: 1; // swmod 080130.
157 sal_Bool mbBookView
: 1; // View mode for page preview.
158 sal_Bool mbViewLayoutBookMode
: 1; // Book view mode for edit view.
159 sal_Bool bShowPlaceHolderFields
: 1; // Only used in printing!
163 sal_uInt16 nZoom
; // In percent.
164 SvxZoomType eZoom
; // 'enum' for zoom.
166 sal_uInt8 nTblDest
; // Destination for table background.
169 // Corresponds to statements in ui/config/cfgvw.src.
170 bool m_bTest1
:1; // Test-flag "Layout not loading"
171 bool m_bTest2
:1; // Test-flag "WYSIWYG++"
172 bool m_bTest3
:1; // Test-flag ""
173 bool m_bTest4
:1; // Test-flag "WYSIWYG debug"
174 bool m_bTest5
:1; // Test-flag "No idle format"
175 bool m_bTest6
:1; // Test-flag "No screen adj"
176 bool m_bTest7
:1; // Test-flag "win format"
177 bool m_bTest8
:1; // Test-flag ""
178 static bool s_bTest9
; // Test-Flag "DrawingLayerNotLoading"
179 bool m_bTest10
:1; // Test-Flag "Format by Input"
183 SwViewOption(); // CTOR
184 SwViewOption(const SwViewOption
&);
187 void Init( Window
*pWin
); // Initializing of static data.
189 sal_uInt16
GetPixelTwips() const { return nPixelTwips
; }
191 inline sal_uInt32
GetCoreOptions() const {return nCoreOptions
;}
192 inline void SetUIOptions( const SwViewOption
& );
194 /*---------------------------------------------------------------------------
195 Options from nCoreOptions
196 ----------------------------------------------------------------------------*/
198 inline sal_Bool
IsIdle() const
201 // Logically this is a const function since it does not modify the viewoptions
202 // but only effects idle formatting. Of course that member is already implement
203 // in the wrong place here... Also currently there are many const modifying casts in the code
204 // just to call this function on otherwise const objects. Thus declaring it as const now.
205 inline void SetIdle( sal_Bool b
) const
208 inline sal_Bool
IsTab(sal_Bool bHard
= sal_False
) const
209 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_TAB
) &&
210 ((nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
)||bHard
)
211 ? sal_True
: sal_False
; }
212 inline void SetTab( sal_Bool b
) {
213 (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_TAB
) : ( nCoreOptions
&= ~VIEWOPT_1_TAB
); }
215 inline sal_Bool
IsBlank(sal_Bool bHard
= sal_False
) const
216 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_BLANK
) &&
217 ((nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
)||bHard
)
218 ? sal_True
: sal_False
; }
219 inline void SetBlank( sal_Bool b
)
220 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_BLANK
) : ( nCoreOptions
&= ~VIEWOPT_1_BLANK
); }
222 inline sal_Bool
IsHardBlank() const
223 { return !bReadonly
&& nCoreOptions
& VIEWOPT_1_HARDBLANK
? sal_True
: sal_False
; }
224 inline void SetHardBlank( sal_Bool b
)
225 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_HARDBLANK
) : ( nCoreOptions
&= ~VIEWOPT_1_HARDBLANK
); }
227 inline sal_Bool
IsParagraph(sal_Bool bHard
= sal_False
) const
228 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_PARAGRAPH
) &&
229 ((nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
)||bHard
)
230 ? sal_True
: sal_False
; }
231 inline void SetParagraph( sal_Bool b
)
232 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_PARAGRAPH
) : ( nCoreOptions
&= ~VIEWOPT_1_PARAGRAPH
); }
234 inline sal_Bool
IsLineBreak(sal_Bool bHard
= sal_False
) const
235 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_LINEBREAK
) &&
236 ((nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
)||bHard
)
237 ? sal_True
: sal_False
; }
238 inline void SetLineBreak( sal_Bool b
)
239 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_LINEBREAK
) : ( nCoreOptions
&= ~VIEWOPT_1_LINEBREAK
); }
241 inline void SetPageBreak( sal_Bool b
)
242 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_PAGEBREAK
) : ( nCoreOptions
&= ~VIEWOPT_1_PAGEBREAK
); }
244 inline void SetColumnBreak( sal_Bool b
)
245 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_COLUMNBREAK
) : ( nCoreOptions
&= ~VIEWOPT_1_COLUMNBREAK
); }
247 inline sal_Bool
IsSoftHyph() const
248 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_SOFTHYPH
) ? sal_True
: sal_False
; }
249 inline void SetSoftHyph( sal_Bool b
)
250 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_SOFTHYPH
) : ( nCoreOptions
&= ~VIEWOPT_1_SOFTHYPH
); }
252 inline sal_Bool
IsFldName() const { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_FLDNAME
) ? sal_True
: sal_False
; }
253 inline void SetFldName( sal_Bool b
)
254 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_FLDNAME
) : ( nCoreOptions
&= ~VIEWOPT_1_FLDNAME
); }
256 inline sal_Bool
IsPostIts() const
257 { return (nCoreOptions
& VIEWOPT_1_POSTITS
) ? sal_True
: sal_False
; }
258 inline void SetPostIts( sal_Bool b
)
259 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_POSTITS
) : ( nCoreOptions
&= ~VIEWOPT_1_POSTITS
); }
260 void PaintPostIts( OutputDevice
*pOut
, const SwRect
&rRect
,
261 sal_Bool bIsScript
) const;
262 sal_uInt16
GetPostItsWidth( const OutputDevice
*pOut
= 0 ) const;
264 inline sal_Bool
IsShowHiddenChar(sal_Bool bHard
= sal_False
) const
265 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_CHAR_HIDDEN
) &&
266 ((nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
)||bHard
)
267 ? sal_True
: sal_False
; }
269 inline void SetShowHiddenChar( sal_Bool b
)
270 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_CHAR_HIDDEN
) : ( nCoreOptions
&= ~VIEWOPT_1_CHAR_HIDDEN
); }
273 inline sal_Bool
IsShowHiddenField() const
274 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_FLD_HIDDEN
) ? sal_True
: sal_False
; }
275 inline void SetShowHiddenField( sal_Bool b
)
276 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_FLD_HIDDEN
) : ( nCoreOptions
&= ~VIEWOPT_1_FLD_HIDDEN
); }
278 inline sal_Bool
IsGraphic() const
279 { return nCoreOptions
& VIEWOPT_1_GRAPHIC
? sal_True
: sal_False
; }
280 inline void SetGraphic( sal_Bool b
)
281 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_GRAPHIC
) : ( nCoreOptions
&= ~VIEWOPT_1_GRAPHIC
); }
283 inline sal_Bool
IsPageBack() const
284 { return nCoreOptions
& VIEWOPT_1_PAGEBACK
? sal_True
: sal_False
; }
285 inline void SetPageBack( sal_Bool b
)
286 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_PAGEBACK
) : ( nCoreOptions
&= ~VIEWOPT_1_PAGEBACK
); }
288 inline sal_Bool
IsTable() const
289 { return nCoreOptions
& VIEWOPT_1_TABLE
? sal_True
: sal_False
; }
290 inline void SetTable( sal_Bool b
)
291 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_TABLE
) : ( nCoreOptions
&= ~VIEWOPT_1_TABLE
); }
293 inline sal_Bool
IsDraw() const
294 { return nCoreOptions
& VIEWOPT_1_DRAW
? sal_True
: sal_False
; }
295 inline void SetDraw( sal_Bool b
)
296 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_DRAW
) : ( nCoreOptions
&= ~VIEWOPT_1_DRAW
); }
298 inline sal_Bool
IsControl() const
299 { return nCoreOptions
& VIEWOPT_1_CONTROL
? sal_True
: sal_False
; }
300 inline void SetControl( sal_Bool b
)
301 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_CONTROL
) : ( nCoreOptions
&= ~VIEWOPT_1_CONTROL
); }
303 inline sal_Bool
IsSnap() const
304 { return nCoreOptions
& VIEWOPT_1_SNAP
? sal_True
: sal_False
; }
305 inline void SetSnap( sal_Bool b
)
306 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_SNAP
) : ( nCoreOptions
&= ~VIEWOPT_1_SNAP
); }
308 inline void SetSnapSize( Size
&rSz
){ aSnapSize
= rSz
; }
309 inline const Size
&GetSnapSize() const { return aSnapSize
; }
311 inline sal_Bool
IsGridVisible() const
312 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_GRIDVISIBLE
) ? sal_True
: sal_False
; }
313 inline void SetGridVisible( sal_Bool b
)
314 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_GRIDVISIBLE
) : ( nCoreOptions
&= ~VIEWOPT_1_GRIDVISIBLE
); }
316 inline sal_Bool
IsOnlineSpell() const
317 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_ONLINESPELL
) ? sal_True
: sal_False
; }
318 inline void SetOnlineSpell( sal_Bool b
)
319 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_ONLINESPELL
) : ( nCoreOptions
&= ~VIEWOPT_1_ONLINESPELL
); }
321 inline sal_Bool
IsViewMetaChars() const
322 { return !bReadonly
&& (nCoreOptions
& VIEWOPT_1_VIEWMETACHARS
) ? sal_True
: sal_False
; }
323 inline void SetViewMetaChars( sal_Bool b
)
324 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_VIEWMETACHARS
) : ( nCoreOptions
&= ~VIEWOPT_1_VIEWMETACHARS
); }
326 inline sal_Bool
IsSynchronize() const
327 { return nCoreOptions
& VIEWOPT_1_SYNCHRONIZE
? sal_True
: sal_False
;}
328 inline void SetSynchronize( sal_Bool b
)
329 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_SYNCHRONIZE
) : ( nCoreOptions
&= ~VIEWOPT_1_SYNCHRONIZE
); }
331 inline sal_Bool
IsCrossHair() const
332 { return nCoreOptions
& VIEWOPT_1_CROSSHAIR
? sal_True
: sal_False
; }
333 inline void SetCrossHair( sal_Bool b
)
334 { (b
!= 0) ? (nCoreOptions
|= VIEWOPT_1_CROSSHAIR
) : ( nCoreOptions
&= ~VIEWOPT_1_CROSSHAIR
); }
336 /*---------------------------------------------------------------------------
337 Options from nCore2Options
338 ----------------------------------------------------------------------------*/
339 inline sal_Bool
IsBlackFont() const
340 {return nCore2Options
& VIEWOPT_CORE2_BLACKFONT
? sal_True
: sal_False
;}
342 inline void SetBlackFont(sal_Bool b
)
343 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_BLACKFONT
) : (nCore2Options
&= ~VIEWOPT_CORE2_BLACKFONT
);}
345 inline sal_Bool
IsShowHiddenPara() const
346 {return nCore2Options
& VIEWOPT_CORE2_HIDDENPARA
? sal_True
: sal_False
;}
348 inline void SetShowHiddenPara(sal_Bool b
)
349 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_HIDDENPARA
) : (nCore2Options
&= ~VIEWOPT_CORE2_HIDDENPARA
);}
351 inline sal_Bool
IsSmoothScroll() const
352 {return nCore2Options
& VIEWOPT_CORE2_SMOOTHSCROLL
? sal_True
: sal_False
;}
354 inline void SetSmoothScroll(sal_Bool b
)
355 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_SMOOTHSCROLL
) : (nCore2Options
&= ~VIEWOPT_CORE2_SMOOTHSCROLL
);}
357 inline sal_Bool
IsCursorInProtectedArea() const
358 {return nCore2Options
& VIEWOPT_CORE2_CRSR_IN_PROT
? sal_True
: sal_False
;}
360 inline void SetCursorInProtectedArea(sal_Bool b
)
361 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_CRSR_IN_PROT
) : (nCore2Options
&= ~VIEWOPT_CORE2_CRSR_IN_PROT
);}
363 inline sal_Bool
IsPDFExport() const
364 {return nCore2Options
& VIEWOPT_CORE2_PDF_EXPORT
? sal_True
: sal_False
;}
366 inline void SetPDFExport(sal_Bool b
)
367 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_PDF_EXPORT
) : (nCore2Options
&= ~VIEWOPT_CORE2_PDF_EXPORT
);}
369 inline sal_Bool
IsPrinting() const
370 {return nCore2Options
& VIEWOPT_CORE2_PRINTING
? sal_True
: sal_False
;}
372 inline void SetPrinting(sal_Bool b
)
373 { (b
!= 0) ? (nCore2Options
|= VIEWOPT_CORE2_PRINTING
) : (nCore2Options
&= ~VIEWOPT_CORE2_PRINTING
);}
375 inline short GetDivisionX() const { return nDivisionX
; }
376 inline void SetDivisionX( short n
){ nDivisionX
= n
; }
377 inline short GetDivisionY() const { return nDivisionY
; }
378 inline void SetDivisionY( short n
){ nDivisionY
= n
; }
380 inline sal_uInt8
GetPagePrevRow() const { return nPagePrevRow
; }
381 inline void SetPagePrevRow( sal_uInt8 n
) { nPagePrevRow
= n
; }
382 inline sal_uInt8
GetPagePrevCol() const { return nPagePrevCol
; }
383 inline void SetPagePrevCol( sal_uInt8 n
) { nPagePrevCol
= n
; }
384 sal_Bool
IsReadonly() const { return bReadonly
; }
385 void SetReadonly(sal_Bool bSet
) { bReadonly
= bSet
; }
387 sal_Bool
IsSelectionInReadonly() const {return bSelectionInReadonly
;}
388 void SetSelectionInReadonly(sal_Bool bSet
) {bSelectionInReadonly
= bSet
;}
390 sal_Bool
IsFormView() const { return mbFormView
; }
391 void SetFormView( sal_Bool bSet
) { mbFormView
= bSet
; }
393 inline sal_Bool
getBrowseMode() const { return mbBrowseMode
; }
394 inline void setBrowseMode(sal_Bool bSet
) { mbBrowseMode
= bSet
; }
395 inline sal_Bool
IsPagePrevBookview() const { return mbBookView
; }
396 inline void SetPagePrevBookview(sal_Bool bSet
) { mbBookView
= bSet
; }
398 sal_Bool
IsAutoCompleteWords() const;
400 bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode
; }
401 void SetViewLayoutBookMode( bool bNew
) { mbViewLayoutBookMode
= bNew
; }
402 sal_uInt16
GetViewLayoutColumns() const { return mnViewLayoutColumns
; }
403 void SetViewLayoutColumns( sal_uInt16 nNew
) { mnViewLayoutColumns
= nNew
; }
406 // Correspond to statements in ui/config/cfgvw.src.
407 inline bool IsTest1() const { return m_bTest1
; }
408 inline void SetTest1( bool b
) { m_bTest1
= b
; }
409 inline bool IsTest2() const { return m_bTest2
; }
410 inline void SetTest2( bool b
) { m_bTest2
= b
; }
411 inline bool IsTest3() const { return m_bTest3
; }
412 inline void SetTest3( bool b
) { m_bTest3
= b
; }
413 inline bool IsTest4() const { return m_bTest4
; }
414 inline void SetTest4( bool b
) { m_bTest4
= b
; }
415 inline bool IsTest5() const { return m_bTest5
; }
416 inline void SetTest5( bool b
) { m_bTest5
= b
; }
417 inline bool IsTest6() const { return m_bTest6
; }
418 inline void SetTest6( bool b
) { m_bTest6
= b
; }
419 inline bool IsTest7() const { return m_bTest7
; }
420 inline void SetTest7( bool b
) { m_bTest7
= b
; }
421 inline bool IsTest8() const { return m_bTest8
; }
422 inline void SetTest8( bool b
) { m_bTest8
= b
; }
423 static inline bool IsTest9() { return s_bTest9
; }
424 static inline void SetTest9( bool b
) { s_bTest9
= b
; }
425 inline bool IsTest10() const { return m_bTest10
; }
426 inline void SetTest10( bool b
) { m_bTest10
= b
; }
429 inline sal_uInt16
GetZoom() const { return nZoom
; }
430 inline void SetZoom( sal_uInt16 n
){ nZoom
= n
; }
432 void DrawRect( OutputDevice
* pOut
, const SwRect
&rRect
, long nCol
) const;
433 void DrawRectPrinter( OutputDevice
* pOut
, const SwRect
& rRect
) const;
435 SwViewOption
& operator=( const SwViewOption
&rOpt
);
438 bool IsEqualFlags ( const SwViewOption
&rOpt
) const;
439 inline bool operator == ( const SwViewOption
&rOpt
) const;
440 inline bool operator != ( const SwViewOption
&rOpt
) const { return !(*this == rOpt
); }
443 /*---------------------------------------------------------------------------
444 Options from nUIOptions
445 ----------------------------------------------------------------------------*/
447 sal_Bool
IsViewVScrollBar() const
449 #if HAVE_FEATURE_DESKTOP_GUI_ELEMENTS
450 return nUIOptions
& VIEWOPT_2_VSCROLLBAR
? sal_True
: sal_False
;
455 sal_Bool
IsViewHScrollBar() const
457 #if HAVE_FEATURE_DESKTOP_GUI_ELEMENTS
458 return nUIOptions
& VIEWOPT_2_HSCROLLBAR
? sal_True
: sal_False
;
463 sal_Bool
IsKeepRatio() const
464 { return nUIOptions
& VIEWOPT_2_KEEPASPECTRATIO
? sal_True
: sal_False
; }
465 sal_Bool
IsGrfKeepZoom() const
466 { return nUIOptions
& VIEWOPT_2_GRFKEEPZOOM
? sal_True
: sal_False
; }
467 sal_Bool
IsShowContentTips() const
468 { return nUIOptions
& VIEWOPT_2_CONTENT_TIPS
? sal_True
: sal_False
; }
469 sal_Bool
IsPrtFormat() const
470 { return nUIOptions
& VIEWOPT_2_PRTFORMAT
? sal_True
: sal_False
; }
472 SvxZoomType
GetZoomType() const { return eZoom
; }
474 sal_uInt8
GetTblDest() const { return nTblDest
; }
476 void SetViewVScrollBar(sal_Bool b
)
477 { b
? (nUIOptions
|= VIEWOPT_2_VSCROLLBAR
) : ( nUIOptions
&= ~VIEWOPT_2_VSCROLLBAR
); }
478 void SetViewHScrollBar(sal_Bool b
)
479 { b
? (nUIOptions
|= VIEWOPT_2_HSCROLLBAR
) : ( nUIOptions
&= ~VIEWOPT_2_HSCROLLBAR
); }
480 void SetKeepRatio (sal_Bool b
)
481 { b
? (nUIOptions
|= VIEWOPT_2_KEEPASPECTRATIO
) : ( nUIOptions
&= ~VIEWOPT_2_KEEPASPECTRATIO
); }
482 void SetGrfKeepZoom (sal_Bool b
)
483 { b
? (nUIOptions
|= VIEWOPT_2_GRFKEEPZOOM
) : ( nUIOptions
&= ~VIEWOPT_2_GRFKEEPZOOM
); }
484 void SetShowContentTips( sal_Bool b
)
485 { b
? (nUIOptions
|= VIEWOPT_2_CONTENT_TIPS
) : (nUIOptions
&= ~VIEWOPT_2_CONTENT_TIPS
); }
486 void SetPrtFormat( sal_Bool b
)
487 { b
? (nUIOptions
|= VIEWOPT_2_PRTFORMAT
) : (nUIOptions
&= ~VIEWOPT_2_PRTFORMAT
); }
489 void SetZoomType (SvxZoomType eZoom_
){ eZoom
= eZoom_
; }
490 void SetTblDest( sal_uInt8 nNew
) { nTblDest
= nNew
; }
492 const OUString
& GetSymbolFont() const {return sSymbolFont
;}
493 void SetSymbolFont(const OUString
& sSet
) {sSymbolFont
= sSet
;}
495 const Color
& GetRetoucheColor() const { return aRetoucheColor
;}
496 void SetRetoucheColor(const Color
&r
) { aRetoucheColor
= r
; }
498 sal_Bool
IsViewAnyRuler() const
500 #if HAVE_FEATURE_DESKTOP_GUI_ELEMENTS
501 return 0 != (nUIOptions
& VIEWOPT_2_ANY_RULER
);
506 void SetViewAnyRuler(sal_Bool bSet
)
507 { bSet
? (nUIOptions
|= VIEWOPT_2_ANY_RULER
) : (nUIOptions
&= ~VIEWOPT_2_ANY_RULER
);}
509 sal_Bool
IsViewHRuler(sal_Bool bDirect
= sal_False
) const
511 #if HAVE_FEATURE_DESKTOP_GUI_ELEMENTS
512 sal_Bool bRet
= sal::static_int_cast
< sal_Bool
>( bDirect
?
513 0 != (nUIOptions
& VIEWOPT_2_H_RULER
) :
515 (nUIOptions
& (VIEWOPT_2_ANY_RULER
|VIEWOPT_2_H_RULER
)) == (VIEWOPT_2_ANY_RULER
|VIEWOPT_2_H_RULER
)
523 void SetViewHRuler (sal_Bool b
)
524 { b
? (nUIOptions
|= VIEWOPT_2_H_RULER
) : ( nUIOptions
&= ~VIEWOPT_2_H_RULER
);}
526 sal_Bool
IsViewVRuler(sal_Bool bDirect
= sal_False
) const
528 #if HAVE_FEATURE_DESKTOP_GUI_ELEMENTS
529 sal_Bool bRet
= sal::static_int_cast
< sal_Bool
>( bDirect
?
530 0 !=(nUIOptions
& VIEWOPT_2_V_RULER
) :
533 (VIEWOPT_2_ANY_RULER
|VIEWOPT_2_V_RULER
)) == (VIEWOPT_2_ANY_RULER
|VIEWOPT_2_V_RULER
)
541 void SetViewVRuler (sal_Bool b
)
542 { b
? (nUIOptions
|= VIEWOPT_2_V_RULER
) : ( nUIOptions
&= ~VIEWOPT_2_V_RULER
);}
544 // ShadowCursor, switch on/off, get/set color/mode.
545 sal_Bool
IsShadowCursor() const
546 { return nUIOptions
& VIEWOPT_2_SHADOWCRSR
? sal_True
: sal_False
; }
547 void SetShadowCursor(sal_Bool b
)
548 { b
? (nUIOptions
|= VIEWOPT_2_SHADOWCRSR
) : ( nUIOptions
&= ~VIEWOPT_2_SHADOWCRSR
); }
550 //move vertical ruler to the right
551 sal_Bool
IsVRulerRight() const
552 { return nUIOptions
& VIEWOPT_2_V_RULER_RIGHT
? sal_True
: sal_False
; }
553 void SetVRulerRight(sal_Bool b
)
554 { b
? (nUIOptions
|= VIEWOPT_2_V_RULER_RIGHT
) : ( nUIOptions
&= ~VIEWOPT_2_V_RULER_RIGHT
); }
556 sal_Bool
IsStarOneSetting() const {return bStarOneSetting
; }
557 void SetStarOneSetting(sal_Bool bSet
) {bStarOneSetting
= bSet
; }
559 sal_Bool
IsPagePreview() const {return bIsPagePreview
; }
560 void SetPagePreview(sal_Bool bSet
) { bIsPagePreview
= bSet
; }
562 sal_uInt8
GetShdwCrsrFillMode() const { return nShdwCrsrFillMode
; }
563 void SetShdwCrsrFillMode( sal_uInt8 nMode
) { nShdwCrsrFillMode
= nMode
; };
565 sal_Bool
IsShowPlaceHolderFields() const { return bShowPlaceHolderFields
; }
566 void SetShowPlaceHolderFields(sal_Bool bSet
) { bShowPlaceHolderFields
= bSet
; }
568 static Color
& GetDocColor();
569 static Color
& GetDocBoundariesColor();
570 static Color
& GetAppBackgroundColor();
571 static Color
& GetObjectBoundariesColor();
572 static Color
& GetTableBoundariesColor();
573 static Color
& GetIndexShadingsColor();
574 static Color
& GetLinksColor();
575 static Color
& GetVisitedLinksColor();
576 static Color
& GetDirectCursorColor();
577 static Color
& GetTextGridColor();
578 static Color
& GetSpellColor();
579 static Color
& GetSmarttagColor();
580 static Color
& GetShadowColor();
581 SW_DLLPUBLIC
static Color
& GetFontColor();
582 static Color
& GetFieldShadingsColor();
583 static Color
& GetSectionBoundColor();
584 static Color
& GetPageBreakColor();
585 static Color
& GetHeaderFooterMarkColor();
587 static sal_Bool
IsAppearanceFlag(sal_Int32 nFlag
);
589 static sal_Bool
IsDocBoundaries() {return IsAppearanceFlag(VIEWOPT_DOC_BOUNDARIES
);}
590 static sal_Bool
IsObjectBoundaries(){return IsAppearanceFlag(VIEWOPT_OBJECT_BOUNDARIES
);}
591 static sal_Bool
IsTableBoundaries() {return IsAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES
);}
592 static sal_Bool
IsIndexShadings() {return IsAppearanceFlag(VIEWOPT_INDEX_SHADINGS
);}
593 static sal_Bool
IsLinks() {return IsAppearanceFlag(VIEWOPT_LINKS
);}
594 static sal_Bool
IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS
);}
595 static sal_Bool
IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS
);}
596 static sal_Bool
IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES
);}
597 static sal_Bool
IsShadow() {return IsAppearanceFlag(VIEWOPT_SHADOW
);}
599 static void SetAppearanceFlag(sal_Int32 nFlag
, sal_Bool bSet
, sal_Bool bSaveInConfig
= sal_False
);
601 void SetDocBoundaries(sal_Bool bSet
) {SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES
, bSet
);}
603 static void ApplyColorConfigValues(const svtools::ColorConfig
& rConfig
);
607 inline bool SwViewOption::operator==( const SwViewOption
&rOpt
) const
609 return IsEqualFlags( rOpt
) && nZoom
== rOpt
.GetZoom();
612 inline void SwViewOption::SetUIOptions( const SwViewOption
& rVOpt
)
614 nUIOptions
= rVOpt
.nUIOptions
;
615 nTblDest
= rVOpt
.nTblDest
;
616 nShdwCrsrFillMode
= rVOpt
.nShdwCrsrFillMode
;
620 // Helper function for checking HTML-capabilities.
621 SW_DLLPUBLIC sal_uInt16
GetHtmlMode(const SwDocShell
*);
626 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */