Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SW_INC_VIEWOPT_HXX
21 : #define INCLUDED_SW_INC_VIEWOPT_HXX
22 :
23 : #include <config_features.h>
24 :
25 : #include <tools/gen.hxx>
26 : #include <tools/color.hxx>
27 :
28 : #include <sfx2/zoomitem.hxx>
29 : #include <svx/svxids.hrc>
30 : #include "swdllapi.h"
31 : #include "authratr.hxx"
32 :
33 : class SwRect;
34 : class Window;
35 : class OutputDevice;
36 : class SwViewShell;
37 : class SwDocShell;
38 : namespace svtools{ class ColorConfig;}
39 :
40 : #define VIEWOPT_1_TAB 0x00000002L
41 : #define VIEWOPT_1_BLANK 0x00000004L
42 : #define VIEWOPT_1_HARDBLANK 0x00000008L
43 : #define VIEWOPT_1_PARAGRAPH 0x00000010L
44 : #define VIEWOPT_1_LINEBREAK 0x00000020L
45 : #define VIEWOPT_1_PAGEBREAK 0x00000040L
46 : #define VIEWOPT_1_COLUMNBREAK 0x00000080L
47 : #define VIEWOPT_1_SOFTHYPH 0x00000100L
48 :
49 : #define VIEWOPT_1_REF 0x00000400L
50 : #define VIEWOPT_1_FLDNAME 0x00000800L
51 : #define VIEWOPT_1_POSTITS 0x00004000L
52 : #define VIEWOPT_1_FLD_HIDDEN 0x00008000L
53 : #define VIEWOPT_1_CHAR_HIDDEN 0x00010000L
54 : #define VIEWOPT_1_GRAPHIC 0x00020000L
55 : #define VIEWOPT_1_TABLE 0x00040000L
56 : #define VIEWOPT_1_DRAW 0x00080000L
57 : #define VIEWOPT_1_CONTROL 0x00100000L
58 : #define VIEWOPT_1_CROSSHAIR 0x00400000L
59 : #define VIEWOPT_1_SNAP 0x00800000L
60 : #define VIEWOPT_1_SYNCHRONIZE 0x01000000L
61 : #define VIEWOPT_1_GRIDVISIBLE 0x02000000L
62 : #define VIEWOPT_1_ONLINESPELL 0x04000000L
63 : #define VIEWOPT_1_RESERVED1 0x10000000L
64 : #define VIEWOPT_1_VIEWMETACHARS 0x20000000L
65 : #define VIEWOPT_1_PAGEBACK 0x40000000L
66 :
67 : #define VIEWOPT_CORE2_BLACKFONT 0x00000001L
68 : #define VIEWOPT_CORE2_HIDDENPARA 0x00000002L
69 : #define VIEWOPT_CORE2_SMOOTHSCROLL 0x00000004L
70 : #define VIEWOPT_CORE2_CRSR_IN_PROT 0x00000008L
71 : #define VIEWOPT_CORE2_PDF_EXPORT 0x00000010L
72 : #define VIEWOPT_CORE2_PRINTING 0x00000020L
73 :
74 : #define VIEWOPT_2_UNUSED1 0x00000100L
75 : #define VIEWOPT_2_UNUSED2 0x00000200L
76 : #define VIEWOPT_2_H_RULER 0x00000400L
77 : #define VIEWOPT_2_VSCROLLBAR 0x00000800L
78 : #define VIEWOPT_2_HSCROLLBAR 0x00001000L
79 : #define VIEWOPT_2_STATUSLINE 0x00002000L
80 : #define VIEWOPT_2_V_RULER 0x00004000L
81 : #define VIEWOPT_2_ANY_RULER 0x00008000L
82 : #define VIEWOPT_2_MODIFIED 0x00010000L
83 : #define VIEWOPT_2_KEEPASPECTRATIO 0x00020000L
84 : #define VIEWOPT_2_GRFKEEPZOOM 0x00040000L
85 : #define VIEWOPT_2_CONTENT_TIPS 0x00100000L
86 : #define VIEWOPT_2_RESERVED3 0x00200000L
87 : #define VIEWOPT_2_SCROLLBAR_TIPS 0x00400000L
88 : #define VIEWOPT_2_PRTFORMAT 0x00800000L
89 : #define VIEWOPT_2_SHADOWCRSR 0x01000000L
90 : #define VIEWOPT_2_V_RULER_RIGHT 0x02000000L
91 :
92 : // Table background.
93 : #define TBL_DEST_CELL 0
94 : #define TBL_DEST_ROW 1
95 : #define TBL_DEST_TBL 2
96 :
97 : // Appearance flags.
98 : #define VIEWOPT_DOC_BOUNDARIES 0x0001
99 : #define VIEWOPT_OBJECT_BOUNDARIES 0x0002
100 : #define VIEWOPT_TABLE_BOUNDARIES 0x0004
101 : #define VIEWOPT_INDEX_SHADINGS 0x0008
102 : #define VIEWOPT_LINKS 0x0010
103 : #define VIEWOPT_VISITED_LINKS 0x0020
104 : #define VIEWOPT_FIELD_SHADINGS 0x0040
105 : #define VIEWOPT_SECTION_BOUNDARIES 0x0080
106 : #define VIEWOPT_SHADOW 0x0100
107 :
108 : // Implementation in core/text/txtpaint.cxx.
109 : extern void SyncVout( const OutputDevice *pOut );
110 :
111 : class SwViewOption
112 : {
113 : static Color aDocColor; // color of document boundaries
114 : static Color aDocBoundColor; // color of document boundaries
115 : static Color aObjectBoundColor; // color of object boundaries
116 : static Color aAppBackgroundColor; // application background
117 : static Color aTableBoundColor; // color of table boundaries
118 : static Color aFontColor;
119 : static Color aIndexShadingsColor; // background color of indexes
120 : static Color aLinksColor;
121 : static Color aVisitedLinksColor;
122 : static Color aDirectCursorColor;
123 : static Color aTextGridColor;
124 : static Color aSpellColor; // mark color of online spell checking
125 : static Color aSmarttagColor;
126 : static Color aFieldShadingsColor;
127 : static Color aSectionBoundColor;
128 : static Color aPageBreakColor;
129 : static Color aScriptIndicatorColor;
130 : static Color aShadowColor;
131 : static Color aHeaderFooterMarkColor;
132 :
133 : static sal_Int32 nAppearanceFlags;
134 : protected:
135 : static sal_uInt16 nPixelTwips;// 1 Pixel == ? Twips
136 :
137 : OUString sSymbolFont; // Symbolfont.
138 : sal_uInt32 nCoreOptions; // Bits for SwViewShell.
139 : sal_uInt32 nCore2Options; // Bits for SwViewShell.
140 : sal_uInt32 nUIOptions; // UI-Bits
141 : Color aRetoucheColor; // DefaultBackground for BrowseView
142 : Size aSnapSize; // Describes horizontal and vertical snap.
143 : sal_uInt16 mnViewLayoutColumns;// # columns for edit view
144 : short nDivisionX; // Grid division.
145 : short nDivisionY;
146 : sal_uInt8 nPagePrevRow; // Page Preview Row/Columns.
147 : sal_uInt8 nPagePrevCol; // Page Preview Row/Columns.
148 : sal_uInt8 nShdwCrsrFillMode; // FillMode for ShadowCrsr.
149 : sal_Bool bReadonly : 1; // Readonly-Doc.
150 : sal_Bool bStarOneSetting : 1;// Prevent from UI automatics (no scrollbars in readonly documents).
151 : sal_Bool bIsPagePreview : 1; // The preview mustn't print field/footnote/... shadings.
152 : sal_Bool bSelectionInReadonly : 1; // Determines whether selection is switched on in readonly documents.
153 : sal_Bool mbFormView : 1;
154 : sal_Bool mbBrowseMode : 1;
155 : sal_Bool mbBookView : 1; // View mode for page preview.
156 : sal_Bool mbViewLayoutBookMode : 1; // Book view mode for edit view.
157 : sal_Bool bShowPlaceHolderFields : 1; // Only used in printing!
158 : mutable bool bIdle;
159 :
160 : // Scale
161 : sal_uInt16 nZoom; // In percent.
162 : SvxZoomType eZoom; // 'enum' for zoom.
163 :
164 : sal_uInt8 nTblDest; // Destination for table background.
165 :
166 : #ifdef DBG_UTIL
167 : // Corresponds to statements in ui/config/cfgvw.src.
168 : bool m_bTest1 :1; // Test-flag "Layout not loading"
169 : bool m_bTest2 :1; // Test-flag "WYSIWYG++"
170 : bool m_bTest3 :1; // Test-flag ""
171 : bool m_bTest4 :1; // Test-flag "WYSIWYG debug"
172 : bool m_bTest5 :1; // Test-flag "No idle format"
173 : bool m_bTest6 :1; // Test-flag "No screen adj"
174 : bool m_bTest7 :1; // Test-flag "win format"
175 : bool m_bTest8 :1; // Test-flag ""
176 : static bool s_bTest9; // Test-Flag "DrawingLayerNotLoading"
177 : bool m_bTest10 :1; // Test-Flag "Format by Input"
178 : #endif
179 :
180 : public:
181 : SwViewOption(); // CTOR
182 : SwViewOption(const SwViewOption&);
183 : ~SwViewOption();
184 :
185 : void Init( Window *pWin ); // Initializing of static data.
186 :
187 0 : sal_uInt16 GetPixelTwips() const { return nPixelTwips; }
188 :
189 0 : inline sal_uInt32 GetCoreOptions() const {return nCoreOptions;}
190 : inline void SetUIOptions( const SwViewOption& );
191 :
192 : /*---------------------------------------------------------------------------
193 : Options from nCoreOptions
194 : ----------------------------------------------------------------------------*/
195 :
196 0 : inline sal_Bool IsIdle() const
197 0 : { return bIdle; }
198 :
199 : // Logically this is a const function since it does not modify the viewoptions
200 : // but only effects idle formatting. Of course that member is already implement
201 : // in the wrong place here... Also currently there are many const modifying casts in the code
202 : // just to call this function on otherwise const objects. Thus declaring it as const now.
203 0 : inline void SetIdle( sal_Bool b ) const
204 0 : { bIdle = b; }
205 :
206 0 : inline sal_Bool IsTab(sal_Bool bHard = sal_False) const
207 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_TAB) &&
208 0 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
209 0 : ? sal_True : sal_False; }
210 0 : inline void SetTab( sal_Bool b ) {
211 0 : (b != 0) ? (nCoreOptions |= VIEWOPT_1_TAB ) : ( nCoreOptions &= ~VIEWOPT_1_TAB); }
212 :
213 0 : inline sal_Bool IsBlank(sal_Bool bHard = sal_False) const
214 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_BLANK) &&
215 0 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
216 0 : ? sal_True : sal_False; }
217 0 : inline void SetBlank( sal_Bool b )
218 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_BLANK ) : ( nCoreOptions &= ~VIEWOPT_1_BLANK); }
219 :
220 0 : inline sal_Bool IsHardBlank() const
221 0 : { return !bReadonly && nCoreOptions & VIEWOPT_1_HARDBLANK ? sal_True : sal_False; }
222 0 : inline void SetHardBlank( sal_Bool b )
223 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_HARDBLANK ) : ( nCoreOptions &= ~VIEWOPT_1_HARDBLANK); }
224 :
225 0 : inline sal_Bool IsParagraph(sal_Bool bHard = sal_False) const
226 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_PARAGRAPH) &&
227 0 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
228 0 : ? sal_True : sal_False; }
229 0 : inline void SetParagraph( sal_Bool b )
230 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PARAGRAPH ) : ( nCoreOptions &= ~VIEWOPT_1_PARAGRAPH); }
231 :
232 0 : inline sal_Bool IsLineBreak(sal_Bool bHard = sal_False) const
233 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_LINEBREAK) &&
234 0 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
235 0 : ? sal_True : sal_False; }
236 0 : inline void SetLineBreak( sal_Bool b )
237 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_LINEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_LINEBREAK); }
238 :
239 0 : inline void SetPageBreak( sal_Bool b )
240 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PAGEBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBREAK); }
241 :
242 0 : inline void SetColumnBreak( sal_Bool b)
243 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_COLUMNBREAK ) : ( nCoreOptions &= ~VIEWOPT_1_COLUMNBREAK); }
244 :
245 0 : inline sal_Bool IsSoftHyph() const
246 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_SOFTHYPH) ? sal_True : sal_False; }
247 0 : inline void SetSoftHyph( sal_Bool b )
248 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SOFTHYPH ) : ( nCoreOptions &= ~VIEWOPT_1_SOFTHYPH); }
249 :
250 0 : inline sal_Bool IsFldName() const { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLDNAME) ? sal_True : sal_False; }
251 0 : inline void SetFldName( sal_Bool b )
252 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_FLDNAME ) : ( nCoreOptions &= ~VIEWOPT_1_FLDNAME); }
253 :
254 0 : inline sal_Bool IsPostIts() const
255 0 : { return (nCoreOptions & VIEWOPT_1_POSTITS) ? sal_True : sal_False; }
256 0 : inline void SetPostIts( sal_Bool b )
257 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_POSTITS ) : ( nCoreOptions &= ~VIEWOPT_1_POSTITS); }
258 : void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
259 : sal_Bool bIsScript ) const;
260 : sal_uInt16 GetPostItsWidth( const OutputDevice *pOut = 0 ) const;
261 :
262 0 : inline sal_Bool IsShowHiddenChar(sal_Bool bHard = sal_False) const
263 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_CHAR_HIDDEN) &&
264 0 : ((nCoreOptions & VIEWOPT_1_VIEWMETACHARS)||bHard)
265 0 : ? sal_True : sal_False; }
266 :
267 0 : inline void SetShowHiddenChar( sal_Bool b )
268 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CHAR_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_CHAR_HIDDEN); }
269 :
270 0 : inline sal_Bool IsShowHiddenField() const
271 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_FLD_HIDDEN) ? sal_True : sal_False; }
272 0 : inline void SetShowHiddenField( sal_Bool b )
273 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_FLD_HIDDEN ) : ( nCoreOptions &= ~VIEWOPT_1_FLD_HIDDEN); }
274 :
275 0 : inline sal_Bool IsGraphic() const
276 0 : { return nCoreOptions & VIEWOPT_1_GRAPHIC ? sal_True : sal_False; }
277 0 : inline void SetGraphic( sal_Bool b )
278 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_GRAPHIC ) : ( nCoreOptions &= ~VIEWOPT_1_GRAPHIC); }
279 :
280 0 : inline sal_Bool IsPageBack() const
281 0 : { return nCoreOptions & VIEWOPT_1_PAGEBACK ? sal_True : sal_False; }
282 0 : inline void SetPageBack( sal_Bool b )
283 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_PAGEBACK) : ( nCoreOptions &= ~VIEWOPT_1_PAGEBACK); }
284 :
285 0 : inline sal_Bool IsTable() const
286 0 : { return nCoreOptions & VIEWOPT_1_TABLE ? sal_True : sal_False; }
287 0 : inline void SetTable( sal_Bool b )
288 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_TABLE ) : ( nCoreOptions &= ~VIEWOPT_1_TABLE); }
289 :
290 0 : inline sal_Bool IsDraw() const
291 0 : { return nCoreOptions & VIEWOPT_1_DRAW ? sal_True : sal_False; }
292 0 : inline void SetDraw( sal_Bool b )
293 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_DRAW ) : ( nCoreOptions &= ~VIEWOPT_1_DRAW); }
294 :
295 0 : inline sal_Bool IsControl() const
296 0 : { return nCoreOptions & VIEWOPT_1_CONTROL ? sal_True : sal_False; }
297 0 : inline void SetControl( sal_Bool b )
298 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CONTROL ) : ( nCoreOptions &= ~VIEWOPT_1_CONTROL); }
299 :
300 0 : inline sal_Bool IsSnap() const
301 0 : { return nCoreOptions & VIEWOPT_1_SNAP ? sal_True : sal_False; }
302 0 : inline void SetSnap( sal_Bool b )
303 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SNAP ) : ( nCoreOptions &= ~VIEWOPT_1_SNAP); }
304 :
305 0 : inline void SetSnapSize( Size &rSz ){ aSnapSize = rSz; }
306 0 : inline const Size &GetSnapSize() const { return aSnapSize; }
307 :
308 0 : inline sal_Bool IsGridVisible() const
309 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_GRIDVISIBLE) ? sal_True : sal_False; }
310 0 : inline void SetGridVisible( sal_Bool b )
311 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_GRIDVISIBLE ) : ( nCoreOptions &= ~VIEWOPT_1_GRIDVISIBLE); }
312 :
313 0 : inline sal_Bool IsOnlineSpell() const
314 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_ONLINESPELL) ? sal_True : sal_False; }
315 0 : inline void SetOnlineSpell( sal_Bool b )
316 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_ONLINESPELL ) : ( nCoreOptions &= ~VIEWOPT_1_ONLINESPELL); }
317 :
318 0 : inline sal_Bool IsViewMetaChars() const
319 0 : { return !bReadonly && (nCoreOptions & VIEWOPT_1_VIEWMETACHARS) ? sal_True : sal_False; }
320 0 : inline void SetViewMetaChars( sal_Bool b)
321 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_VIEWMETACHARS ) : ( nCoreOptions &= ~VIEWOPT_1_VIEWMETACHARS); }
322 :
323 0 : inline sal_Bool IsSynchronize() const
324 0 : { return nCoreOptions & VIEWOPT_1_SYNCHRONIZE ? sal_True : sal_False;}
325 0 : inline void SetSynchronize( sal_Bool b )
326 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_SYNCHRONIZE ) : ( nCoreOptions &= ~VIEWOPT_1_SYNCHRONIZE); }
327 :
328 0 : inline sal_Bool IsCrossHair() const
329 0 : { return nCoreOptions & VIEWOPT_1_CROSSHAIR ? sal_True : sal_False; }
330 0 : inline void SetCrossHair( sal_Bool b )
331 0 : { (b != 0) ? (nCoreOptions |= VIEWOPT_1_CROSSHAIR ) : ( nCoreOptions &= ~VIEWOPT_1_CROSSHAIR); }
332 :
333 : /*---------------------------------------------------------------------------
334 : Options from nCore2Options
335 : ----------------------------------------------------------------------------*/
336 0 : inline sal_Bool IsBlackFont() const
337 0 : {return nCore2Options & VIEWOPT_CORE2_BLACKFONT ? sal_True : sal_False;}
338 :
339 0 : inline void SetBlackFont(sal_Bool b)
340 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_BLACKFONT) : (nCore2Options &= ~VIEWOPT_CORE2_BLACKFONT);}
341 :
342 0 : inline sal_Bool IsShowHiddenPara() const
343 0 : {return nCore2Options & VIEWOPT_CORE2_HIDDENPARA ? sal_True : sal_False;}
344 :
345 0 : inline void SetShowHiddenPara(sal_Bool b)
346 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_HIDDENPARA) : (nCore2Options &= ~VIEWOPT_CORE2_HIDDENPARA);}
347 :
348 0 : inline sal_Bool IsSmoothScroll() const
349 0 : {return nCore2Options & VIEWOPT_CORE2_SMOOTHSCROLL ? sal_True : sal_False;}
350 :
351 0 : inline void SetSmoothScroll(sal_Bool b)
352 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_SMOOTHSCROLL) : (nCore2Options &= ~VIEWOPT_CORE2_SMOOTHSCROLL);}
353 :
354 0 : inline sal_Bool IsCursorInProtectedArea() const
355 0 : {return nCore2Options & VIEWOPT_CORE2_CRSR_IN_PROT ? sal_True : sal_False;}
356 :
357 0 : inline void SetCursorInProtectedArea(sal_Bool b)
358 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_CRSR_IN_PROT) : (nCore2Options &= ~VIEWOPT_CORE2_CRSR_IN_PROT);}
359 :
360 0 : inline sal_Bool IsPDFExport() const
361 0 : {return nCore2Options & VIEWOPT_CORE2_PDF_EXPORT ? sal_True : sal_False;}
362 :
363 0 : inline void SetPDFExport(sal_Bool b)
364 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PDF_EXPORT) : (nCore2Options &= ~VIEWOPT_CORE2_PDF_EXPORT);}
365 :
366 0 : inline sal_Bool IsPrinting() const
367 0 : {return nCore2Options & VIEWOPT_CORE2_PRINTING ? sal_True : sal_False;}
368 :
369 0 : inline void SetPrinting(sal_Bool b)
370 0 : { (b != 0) ? (nCore2Options |= VIEWOPT_CORE2_PRINTING) : (nCore2Options &= ~VIEWOPT_CORE2_PRINTING);}
371 :
372 0 : inline short GetDivisionX() const { return nDivisionX; }
373 0 : inline void SetDivisionX( short n ){ nDivisionX = n; }
374 0 : inline short GetDivisionY() const { return nDivisionY; }
375 0 : inline void SetDivisionY( short n ){ nDivisionY = n; }
376 :
377 0 : inline sal_uInt8 GetPagePrevRow() const { return nPagePrevRow; }
378 0 : inline void SetPagePrevRow( sal_uInt8 n ) { nPagePrevRow = n; }
379 0 : inline sal_uInt8 GetPagePrevCol() const { return nPagePrevCol; }
380 0 : inline void SetPagePrevCol( sal_uInt8 n ) { nPagePrevCol = n; }
381 0 : sal_Bool IsReadonly() const { return bReadonly; }
382 0 : void SetReadonly(sal_Bool bSet) { bReadonly = bSet; }
383 :
384 0 : sal_Bool IsSelectionInReadonly() const {return bSelectionInReadonly;}
385 0 : void SetSelectionInReadonly(sal_Bool bSet) {bSelectionInReadonly = bSet;}
386 :
387 0 : sal_Bool IsFormView() const { return mbFormView; }
388 0 : void SetFormView( sal_Bool bSet ) { mbFormView = bSet; }
389 :
390 0 : inline sal_Bool getBrowseMode() const { return mbBrowseMode; }
391 0 : inline void setBrowseMode(sal_Bool bSet) { mbBrowseMode = bSet; }
392 0 : inline sal_Bool IsPagePrevBookview() const { return mbBookView; }
393 0 : inline void SetPagePrevBookview(sal_Bool bSet) { mbBookView = bSet; }
394 :
395 : sal_Bool IsAutoCompleteWords() const;
396 :
397 0 : bool IsViewLayoutBookMode() const { return mbViewLayoutBookMode; }
398 0 : void SetViewLayoutBookMode( bool bNew ) { mbViewLayoutBookMode = bNew; }
399 0 : sal_uInt16 GetViewLayoutColumns() const { return mnViewLayoutColumns; }
400 0 : void SetViewLayoutColumns( sal_uInt16 nNew ) { mnViewLayoutColumns = nNew; }
401 :
402 : #ifdef DBG_UTIL
403 : // Correspond to statements in ui/config/cfgvw.src.
404 : inline bool IsTest1() const { return m_bTest1; }
405 : inline void SetTest1( bool b ) { m_bTest1 = b; }
406 : inline bool IsTest2() const { return m_bTest2; }
407 : inline void SetTest2( bool b ) { m_bTest2 = b; }
408 : inline bool IsTest3() const { return m_bTest3; }
409 : inline void SetTest3( bool b ) { m_bTest3 = b; }
410 : inline bool IsTest4() const { return m_bTest4; }
411 : inline void SetTest4( bool b ) { m_bTest4 = b; }
412 : inline bool IsTest5() const { return m_bTest5; }
413 : inline void SetTest5( bool b ) { m_bTest5 = b; }
414 : inline bool IsTest6() const { return m_bTest6; }
415 : inline void SetTest6( bool b ) { m_bTest6 = b; }
416 : inline bool IsTest7() const { return m_bTest7; }
417 : inline void SetTest7( bool b ) { m_bTest7 = b; }
418 : inline bool IsTest8() const { return m_bTest8; }
419 : inline void SetTest8( bool b ) { m_bTest8 = b; }
420 : static inline bool IsTest9() { return s_bTest9; }
421 : static inline void SetTest9( bool b ) { s_bTest9 = b; }
422 : inline bool IsTest10() const { return m_bTest10; }
423 : inline void SetTest10( bool b ) { m_bTest10 = b; }
424 : #endif
425 :
426 0 : inline sal_uInt16 GetZoom() const { return nZoom; }
427 0 : inline void SetZoom( sal_uInt16 n ){ nZoom = n; }
428 :
429 : void DrawRect( OutputDevice* pOut, const SwRect &rRect, long nCol ) const;
430 : void DrawRectPrinter( OutputDevice* pOut, const SwRect& rRect ) const;
431 :
432 : SwViewOption& operator=( const SwViewOption &rOpt );
433 :
434 : // Compare methods.
435 : bool IsEqualFlags ( const SwViewOption &rOpt ) const;
436 : inline bool operator == ( const SwViewOption &rOpt ) const;
437 0 : inline bool operator != ( const SwViewOption &rOpt ) const { return !(*this == rOpt); }
438 :
439 : /*---------------------------------------------------------------------------
440 : Options from nUIOptions
441 : ----------------------------------------------------------------------------*/
442 :
443 0 : sal_Bool IsViewVScrollBar() const
444 : {
445 : #if HAVE_FEATURE_DESKTOP
446 0 : return nUIOptions & VIEWOPT_2_VSCROLLBAR ? sal_True : sal_False;
447 : #else
448 : return sal_False;
449 : #endif
450 : }
451 0 : sal_Bool IsViewHScrollBar() const
452 : {
453 : #if HAVE_FEATURE_DESKTOP
454 0 : return nUIOptions & VIEWOPT_2_HSCROLLBAR ? sal_True : sal_False;
455 : #else
456 : return sal_False;
457 : #endif
458 : }
459 0 : sal_Bool IsKeepRatio() const
460 0 : { return nUIOptions & VIEWOPT_2_KEEPASPECTRATIO ? sal_True : sal_False; }
461 0 : sal_Bool IsGrfKeepZoom() const
462 0 : { return nUIOptions & VIEWOPT_2_GRFKEEPZOOM ? sal_True : sal_False; }
463 0 : sal_Bool IsShowContentTips() const
464 0 : { return nUIOptions & VIEWOPT_2_CONTENT_TIPS ? sal_True : sal_False; }
465 0 : sal_Bool IsPrtFormat() const
466 0 : { return nUIOptions & VIEWOPT_2_PRTFORMAT ? sal_True : sal_False; }
467 0 : sal_Bool IsShowScrollBarTips() const
468 0 : { return nUIOptions & VIEWOPT_2_SCROLLBAR_TIPS ? sal_True : sal_False; }
469 :
470 0 : SvxZoomType GetZoomType() const { return eZoom; }
471 :
472 0 : sal_uInt8 GetTblDest() const { return nTblDest; }
473 :
474 0 : void SetViewVScrollBar(sal_Bool b)
475 0 : { b ? (nUIOptions |= VIEWOPT_2_VSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_VSCROLLBAR); }
476 0 : void SetViewHScrollBar(sal_Bool b)
477 0 : { b ? (nUIOptions |= VIEWOPT_2_HSCROLLBAR ) : ( nUIOptions &= ~VIEWOPT_2_HSCROLLBAR); }
478 0 : void SetKeepRatio (sal_Bool b)
479 0 : { b ? (nUIOptions |= VIEWOPT_2_KEEPASPECTRATIO ) : ( nUIOptions &= ~VIEWOPT_2_KEEPASPECTRATIO); }
480 0 : void SetGrfKeepZoom (sal_Bool b)
481 0 : { b ? (nUIOptions |= VIEWOPT_2_GRFKEEPZOOM ) : ( nUIOptions &= ~VIEWOPT_2_GRFKEEPZOOM); }
482 0 : void SetShowContentTips( sal_Bool b)
483 0 : { b ? (nUIOptions |= VIEWOPT_2_CONTENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_CONTENT_TIPS); }
484 0 : void SetPrtFormat( sal_Bool b)
485 0 : { b ? (nUIOptions |= VIEWOPT_2_PRTFORMAT) : (nUIOptions &= ~VIEWOPT_2_PRTFORMAT); }
486 0 : void SetShowScrollBarTips( sal_Bool b)
487 0 : { b ? (nUIOptions |= VIEWOPT_2_SCROLLBAR_TIPS) : (nUIOptions &= ~VIEWOPT_2_SCROLLBAR_TIPS); }
488 :
489 0 : void SetZoomType (SvxZoomType eZoom_){ eZoom = eZoom_; }
490 0 : void SetTblDest( sal_uInt8 nNew ) { nTblDest = nNew; }
491 :
492 0 : const OUString& GetSymbolFont() const {return sSymbolFont;}
493 0 : void SetSymbolFont(const OUString& sSet) {sSymbolFont = sSet;}
494 :
495 0 : const Color& GetRetoucheColor() const { return aRetoucheColor;}
496 0 : void SetRetoucheColor(const Color&r) { aRetoucheColor = r; }
497 :
498 0 : sal_Bool IsViewAnyRuler() const
499 : {
500 : #if HAVE_FEATURE_DESKTOP
501 0 : return 0 != (nUIOptions & VIEWOPT_2_ANY_RULER);
502 : #else
503 : return sal_False;
504 : #endif
505 : }
506 0 : void SetViewAnyRuler(sal_Bool bSet)
507 0 : { bSet ? (nUIOptions |= VIEWOPT_2_ANY_RULER) : (nUIOptions &= ~VIEWOPT_2_ANY_RULER);}
508 :
509 0 : sal_Bool IsViewHRuler(sal_Bool bDirect = sal_False) const
510 : {
511 : #if HAVE_FEATURE_DESKTOP
512 : sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
513 0 : 0 != (nUIOptions & VIEWOPT_2_H_RULER) :
514 0 : !bReadonly ?
515 0 : (nUIOptions & (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_H_RULER)
516 0 : : sal_False );
517 0 : return bRet;
518 : #else
519 : (void) bDirect;
520 : return sal_False;
521 : #endif
522 : }
523 0 : void SetViewHRuler (sal_Bool b)
524 0 : { b ? (nUIOptions |= VIEWOPT_2_H_RULER ) : ( nUIOptions &= ~VIEWOPT_2_H_RULER);}
525 :
526 0 : sal_Bool IsViewVRuler(sal_Bool bDirect = sal_False) const
527 : {
528 : #if HAVE_FEATURE_DESKTOP
529 : sal_Bool bRet = sal::static_int_cast< sal_Bool >( bDirect ?
530 0 : 0 !=(nUIOptions & VIEWOPT_2_V_RULER) :
531 0 : !bReadonly ?
532 0 : (nUIOptions &
533 : (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)) == (VIEWOPT_2_ANY_RULER|VIEWOPT_2_V_RULER)
534 0 : : sal_False );
535 0 : return bRet;
536 : #else
537 : (void) bDirect;
538 : return sal_False;
539 : #endif
540 : }
541 0 : void SetViewVRuler (sal_Bool b)
542 0 : { b ? (nUIOptions |= VIEWOPT_2_V_RULER ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER);}
543 :
544 : // ShadowCursor, switch on/off, get/set color/mode.
545 0 : sal_Bool IsShadowCursor() const
546 0 : { return nUIOptions & VIEWOPT_2_SHADOWCRSR ? sal_True : sal_False; }
547 0 : void SetShadowCursor(sal_Bool b)
548 0 : { b ? (nUIOptions |= VIEWOPT_2_SHADOWCRSR ) : ( nUIOptions &= ~VIEWOPT_2_SHADOWCRSR); }
549 :
550 : //move vertical ruler to the right
551 0 : sal_Bool IsVRulerRight() const
552 0 : { return nUIOptions & VIEWOPT_2_V_RULER_RIGHT ? sal_True : sal_False; }
553 0 : void SetVRulerRight(sal_Bool b)
554 0 : { b ? (nUIOptions |= VIEWOPT_2_V_RULER_RIGHT ) : ( nUIOptions &= ~VIEWOPT_2_V_RULER_RIGHT); }
555 :
556 0 : sal_Bool IsStarOneSetting() const {return bStarOneSetting; }
557 0 : void SetStarOneSetting(sal_Bool bSet) {bStarOneSetting = bSet; }
558 :
559 0 : sal_Bool IsPagePreview() const {return bIsPagePreview; }
560 0 : void SetPagePreview(sal_Bool bSet) { bIsPagePreview= bSet; }
561 :
562 0 : sal_uInt8 GetShdwCrsrFillMode() const { return nShdwCrsrFillMode; }
563 0 : void SetShdwCrsrFillMode( sal_uInt8 nMode ) { nShdwCrsrFillMode = nMode; };
564 :
565 0 : sal_Bool IsShowPlaceHolderFields() const { return bShowPlaceHolderFields; }
566 0 : void SetShowPlaceHolderFields(sal_Bool bSet) { bShowPlaceHolderFields = bSet; }
567 :
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();
586 :
587 : static sal_Bool IsAppearanceFlag(sal_Int32 nFlag);
588 :
589 0 : static sal_Bool IsDocBoundaries() {return IsAppearanceFlag(VIEWOPT_DOC_BOUNDARIES);}
590 0 : static sal_Bool IsObjectBoundaries(){return IsAppearanceFlag(VIEWOPT_OBJECT_BOUNDARIES);}
591 0 : static sal_Bool IsTableBoundaries() {return IsAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES );}
592 0 : static sal_Bool IsIndexShadings() {return IsAppearanceFlag(VIEWOPT_INDEX_SHADINGS );}
593 0 : static sal_Bool IsLinks() {return IsAppearanceFlag(VIEWOPT_LINKS );}
594 0 : static sal_Bool IsVisitedLinks() {return IsAppearanceFlag(VIEWOPT_VISITED_LINKS );}
595 0 : static sal_Bool IsFieldShadings() {return IsAppearanceFlag(VIEWOPT_FIELD_SHADINGS);}
596 0 : static sal_Bool IsSectionBoundaries() {return IsAppearanceFlag(VIEWOPT_SECTION_BOUNDARIES);}
597 0 : static sal_Bool IsShadow() {return IsAppearanceFlag(VIEWOPT_SHADOW );}
598 :
599 : static void SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig = sal_False);
600 :
601 0 : void SetDocBoundaries(sal_Bool bSet) {SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bSet);}
602 :
603 : static void ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
604 : };
605 :
606 0 : inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
607 : {
608 0 : return IsEqualFlags( rOpt ) && nZoom == rOpt.GetZoom();
609 : }
610 :
611 0 : inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
612 : {
613 0 : nUIOptions = rVOpt.nUIOptions;
614 0 : nTblDest = rVOpt.nTblDest;
615 0 : nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
616 0 : }
617 :
618 : // Helper function for checking HTML-capabilities.
619 : SW_DLLPUBLIC sal_uInt16 GetHtmlMode(const SwDocShell*);
620 :
621 : #endif
622 :
623 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|