Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/htmlmode.hxx>
30 : : #include <svtools/htmlcfg.hxx>
31 : :
32 : : #include <svx/svxids.hrc>
33 : : #include <editeng/svxenum.hxx>
34 : : #include <editeng/svxacorr.hxx>
35 : : #include <unotools/localedatawrapper.hxx>
36 : : #include <vcl/region.hxx>
37 : : #include <vcl/outdev.hxx>
38 : : #include <vcl/window.hxx>
39 : : #include <swmodule.hxx>
40 : : #include <swtypes.hxx>
41 : : #include <viewopt.hxx>
42 : : #include <wdocsh.hxx>
43 : : #include <swrect.hxx>
44 : : #include <crstate.hxx>
45 : : #include <svtools/colorcfg.hxx>
46 : : #include <svtools/accessibilityoptions.hxx>
47 : : #include <unotools/syslocale.hxx>
48 : :
49 : : #include <editeng/acorrcfg.hxx>
50 : :
51 : : #ifdef DBG_UTIL
52 : : bool SwViewOption::s_bTest9 = false; //DrawingLayerNotLoading
53 : : #endif
54 : 73 : Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
55 : 73 : Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
56 : 73 : Color SwViewOption::aDocColor(COL_LIGHTGRAY);
57 : 73 : Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
58 : 73 : Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
59 : 73 : Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
60 : 73 : Color SwViewOption::aLinksColor(COL_BLUE);
61 : 73 : Color SwViewOption::aVisitedLinksColor(COL_RED);
62 : 73 : Color SwViewOption::aDirectCursorColor(COL_BLUE);
63 : 73 : Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
64 : 73 : Color SwViewOption::aSpellColor(COL_LIGHTRED);
65 : 73 : Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
66 : 73 : Color SwViewOption::aFontColor(COL_BLACK);
67 : 73 : Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
68 : 73 : Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
69 : 73 : Color SwViewOption::aPageBreakColor(COL_BLUE);
70 : 73 : Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
71 : 73 : Color SwViewOption::aShadowColor(COL_GRAY);
72 : 73 : Color SwViewOption::aHeaderFooterMarkColor(COL_BLUE);
73 : :
74 : : sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
75 : : sal_uInt16 SwViewOption::nPixelTwips = 0; // one pixel on the screen
76 : :
77 : : static const char aPostItStr[] = " ";
78 : :
79 : 440 : sal_Bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
80 : : {
81 : : return nCoreOptions == rOpt.nCoreOptions
82 : : && nCore2Options == rOpt.nCore2Options
83 : 240 : && aSnapSize == rOpt.aSnapSize
84 : : && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
85 : 224 : && nDivisionX == rOpt.GetDivisionX()
86 : 216 : && nDivisionY == rOpt.GetDivisionY()
87 : 208 : && nPagePrevRow == rOpt.GetPagePrevRow()
88 : 208 : && nPagePrevCol == rOpt.GetPagePrevCol()
89 : 208 : && aRetoucheColor == rOpt.GetRetoucheColor()
90 : 208 : && mbFormView == rOpt.IsFormView()
91 : 208 : && mbBrowseMode == rOpt.getBrowseMode()
92 : : && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
93 : : && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
94 [ + + ]: 2160 : && bIdle == rOpt.bIdle
[ + + + + ]
[ + - + +
+ + + - +
- + - + -
+ + ][ + - ]
[ + - ][ + - ]
95 : : #ifdef DBG_UTIL
96 : : // correspond to the statements in ui/config/cfgvw.src
97 : : && m_bTest1 == rOpt.IsTest1()
98 : : && m_bTest2 == rOpt.IsTest2()
99 : : && m_bTest3 == rOpt.IsTest3()
100 : : && m_bTest4 == rOpt.IsTest4()
101 : : && m_bTest5 == rOpt.IsTest5()
102 : : && m_bTest6 == rOpt.IsTest6()
103 : : && m_bTest7 == rOpt.IsTest7()
104 : : && m_bTest8 == rOpt.IsTest8()
105 : : && m_bTest10 == rOpt.IsTest10()
106 : : #endif
107 : : ;
108 : : }
109 : :
110 : 0 : void SwViewOption::DrawRect( OutputDevice *pOut,
111 : : const SwRect &rRect, long nCol ) const
112 : : {
113 [ # # ]: 0 : if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
114 : : {
115 : 0 : const Color aCol( nCol );
116 : 0 : const Color aOldColor( pOut->GetFillColor() );
117 [ # # ]: 0 : pOut->SetFillColor( aCol );
118 [ # # ][ # # ]: 0 : pOut->DrawRect( rRect.SVRect() );
119 [ # # ]: 0 : pOut->SetFillColor( aOldColor );
120 : : }
121 : : else
122 : 0 : DrawRectPrinter( pOut, rRect );
123 : 0 : }
124 : :
125 : 0 : void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
126 : : const SwRect &rRect ) const
127 : : {
128 : 0 : Color aOldColor(pOut->GetLineColor());
129 : 0 : Color aOldFillColor( pOut->GetFillColor() );
130 [ # # ]: 0 : pOut->SetLineColor( Color(COL_BLACK) );
131 [ # # ]: 0 : pOut->SetFillColor( Color(COL_TRANSPARENT ));
132 [ # # ][ # # ]: 0 : pOut->DrawRect( rRect.SVRect() );
133 [ # # ]: 0 : pOut->SetFillColor( aOldFillColor );
134 [ # # ]: 0 : pOut->SetLineColor( aOldColor );
135 : 0 : }
136 : :
137 : 6 : sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
138 : : {
139 : : OSL_ENSURE( pOut, "no Outdev" );
140 [ + - ][ + - ]: 6 : return sal_uInt16(pOut->GetTextWidth( rtl::OUString(aPostItStr )));
[ + - ]
141 : : }
142 : :
143 : 3 : void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
144 : : {
145 [ + - ][ - + ]: 3 : if( pOut && bIsScript )
146 : : {
147 : 0 : Color aOldLineColor( pOut->GetLineColor() );
148 [ # # ]: 0 : pOut->SetLineColor( Color(COL_GRAY ) );
149 : : // to make it look nice, we subtract two pixels everywhere
150 : 0 : sal_uInt16 nPix = GetPixelTwips() * 2;
151 [ # # ][ # # ]: 0 : if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
[ # # ]
152 : 0 : nPix = 0;
153 : 0 : const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
154 : 0 : const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
155 : 0 : const SwRect aRect( aTopLeft, aBotRight );
156 [ # # ]: 0 : DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
157 [ # # ]: 0 : pOut->SetLineColor( aOldLineColor );
158 : : }
159 : 3 : }
160 : :
161 : 1412 : SwViewOption::SwViewOption() :
162 : : sSymbolFont( RTL_CONSTASCII_USTRINGPARAM( "symbol" ) ),
163 : : aRetoucheColor( COL_TRANSPARENT ),
164 : : mnViewLayoutColumns( 0 ),
165 : : nPagePrevRow( 1 ),
166 : : nPagePrevCol( 2 ),
167 : : nShdwCrsrFillMode( FILL_TAB ),
168 : : bReadonly(sal_False),
169 : : bStarOneSetting(sal_False),
170 : : bIsPagePreview(sal_False),
171 : : bSelectionInReadonly(sal_False),
172 : : mbFormView(sal_False),
173 : : mbBrowseMode(sal_False),
174 : : mbBookView(sal_False),
175 : : mbViewLayoutBookMode(sal_False),
176 : : bShowPlaceHolderFields( sal_True ),
177 : : nZoom( 100 ),
178 : : eZoom( SVX_ZOOM_PERCENT ),
179 : 1412 : nTblDest(TBL_DEST_CELL)
180 : : {
181 : : // Initialisation is a little simpler now
182 : : // all Bits to 0
183 : : nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH |
184 : : VIEWOPT_1_REF |
185 : : VIEWOPT_1_GRAPHIC |
186 : : VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL |
187 : : VIEWOPT_1_PAGEBACK |
188 : 1412 : VIEWOPT_1_POSTITS;
189 : 1412 : nCore2Options = VIEWOPT_CORE2_BLACKFONT | VIEWOPT_CORE2_HIDDENPARA;
190 : 1412 : nUIOptions = VIEWOPT_2_MODIFIED | VIEWOPT_2_GRFKEEPZOOM |VIEWOPT_2_ANY_RULER;
191 : :
192 [ + - ][ + - ]: 1412 : if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
[ + - ][ + - ]
[ + - ]
193 : 1412 : aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2"
194 : : else
195 : 0 : aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm
196 : 1412 : nDivisionX = nDivisionY = 1;
197 : :
198 [ + - ][ + - ]: 1412 : bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
[ + - ]
199 : :
200 : 1412 : bIdle = true;
201 : :
202 : : #ifdef DBG_UTIL
203 : : // correspond to the statements in ui/config/cfgvw.src
204 : : m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 =
205 : : m_bTest5 = m_bTest6 = m_bTest7 = m_bTest8 = m_bTest10 = false;
206 : : #endif
207 : 1412 : }
208 : :
209 : 1857 : SwViewOption::SwViewOption(const SwViewOption& rVOpt)
210 : : {
211 : 1857 : bReadonly = sal_False;
212 : 1857 : bSelectionInReadonly = sal_False;
213 : : // #114856# Formular view
214 : 1857 : mbFormView = rVOpt.mbFormView;
215 : 1857 : nZoom = rVOpt.nZoom ;
216 : 1857 : aSnapSize = rVOpt.aSnapSize ;
217 : 1857 : mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
218 : 1857 : nDivisionX = rVOpt.nDivisionX ;
219 : 1857 : nDivisionY = rVOpt.nDivisionY ;
220 : 1857 : nPagePrevRow = rVOpt.nPagePrevRow;
221 : 1857 : nPagePrevCol = rVOpt.nPagePrevCol;
222 : 1857 : bIsPagePreview = rVOpt.bIsPagePreview;
223 : 1857 : eZoom = rVOpt.eZoom ;
224 : 1857 : nTblDest = rVOpt.nTblDest ;
225 : 1857 : nUIOptions = rVOpt.nUIOptions ;
226 : 1857 : nCoreOptions = rVOpt.nCoreOptions ;
227 : 1857 : nCore2Options = rVOpt.nCore2Options ;
228 : 1857 : aRetoucheColor = rVOpt.GetRetoucheColor();
229 : 1857 : sSymbolFont = rVOpt.sSymbolFont;
230 : 1857 : nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
231 : 1857 : bStarOneSetting = rVOpt.bStarOneSetting;
232 : 1857 : mbBookView = rVOpt.mbBookView;
233 : 1857 : mbBrowseMode = rVOpt.mbBrowseMode;
234 : 1857 : mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
235 : 1857 : bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
236 : 1857 : bIdle = rVOpt.bIdle;
237 : :
238 : : #ifdef DBG_UTIL
239 : : m_bTest1 = rVOpt.m_bTest1;
240 : : m_bTest2 = rVOpt.m_bTest2;
241 : : m_bTest3 = rVOpt.m_bTest3;
242 : : m_bTest4 = rVOpt.m_bTest4;
243 : : m_bTest5 = rVOpt.m_bTest5;
244 : : m_bTest6 = rVOpt.m_bTest6;
245 : : m_bTest7 = rVOpt.m_bTest7;
246 : : m_bTest8 = rVOpt.m_bTest8;
247 : : m_bTest10 = rVOpt.m_bTest10;
248 : : #endif
249 : 1857 : }
250 : :
251 : :
252 : 1559 : SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
253 : : {
254 : : // #114856# Formular view
255 : 1559 : mbFormView = rVOpt.mbFormView ;
256 : 1559 : nZoom = rVOpt.nZoom ;
257 : 1559 : aSnapSize = rVOpt.aSnapSize ;
258 : 1559 : mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
259 : 1559 : nDivisionX = rVOpt.nDivisionX ;
260 : 1559 : nDivisionY = rVOpt.nDivisionY ;
261 : 1559 : nPagePrevRow = rVOpt.nPagePrevRow;
262 : 1559 : nPagePrevCol = rVOpt.nPagePrevCol;
263 : 1559 : bIsPagePreview = rVOpt.bIsPagePreview;
264 : 1559 : eZoom = rVOpt.eZoom ;
265 : 1559 : nTblDest = rVOpt.nTblDest ;
266 : 1559 : nUIOptions = rVOpt.nUIOptions ;
267 : 1559 : nCoreOptions = rVOpt.nCoreOptions;
268 : 1559 : nCore2Options = rVOpt.nCore2Options;
269 : 1559 : aRetoucheColor = rVOpt.GetRetoucheColor();
270 : 1559 : sSymbolFont = rVOpt.sSymbolFont;
271 : 1559 : nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
272 : 1559 : bStarOneSetting = rVOpt.bStarOneSetting;
273 : 1559 : mbBookView = rVOpt.mbBookView;
274 : 1559 : mbBrowseMode = rVOpt.mbBrowseMode;
275 : 1559 : mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
276 : 1559 : bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
277 : 1559 : bIdle = rVOpt.bIdle;
278 : :
279 : : #ifdef DBG_UTIL
280 : : m_bTest1 = rVOpt.m_bTest1;
281 : : m_bTest2 = rVOpt.m_bTest2;
282 : : m_bTest3 = rVOpt.m_bTest3;
283 : : m_bTest4 = rVOpt.m_bTest4;
284 : : m_bTest5 = rVOpt.m_bTest5;
285 : : m_bTest6 = rVOpt.m_bTest6;
286 : : m_bTest7 = rVOpt.m_bTest7;
287 : : m_bTest8 = rVOpt.m_bTest8;
288 : : m_bTest10 = rVOpt.m_bTest10;
289 : : #endif
290 : 1559 : return *this;
291 : : }
292 : :
293 : :
294 : 3143 : SwViewOption::~SwViewOption()
295 : : {
296 : 3143 : }
297 : :
298 : 1318 : void SwViewOption::Init( Window *pWin )
299 : : {
300 [ + + ][ + - ]: 1318 : if( !nPixelTwips && pWin )
301 : : {
302 [ + - ]: 67 : nPixelTwips = (sal_uInt16)pWin->PixelToLogic( Size(1,1) ).Height();
303 : : }
304 : 1318 : }
305 : :
306 : 15715 : sal_Bool SwViewOption::IsAutoCompleteWords() const
307 : : {
308 : 15715 : const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
309 : 15715 : return rFlags.bAutoCmpltCollectWords;
310 : : }
311 : :
312 : 219 : AuthorCharAttr::AuthorCharAttr() :
313 : : nItemId (SID_ATTR_CHAR_UNDERLINE),
314 : : nAttr (UNDERLINE_SINGLE),
315 : 219 : nColor (COL_TRANSPARENT)
316 : : {
317 : 219 : }
318 : :
319 : 5594 : sal_uInt16 GetHtmlMode(const SwDocShell* pShell)
320 : : {
321 : 5594 : sal_uInt16 nRet = 0;
322 [ + + ][ + - ]: 5594 : if(!pShell || PTR_CAST(SwWebDocShell, pShell))
[ + + ][ + - ]
[ + + ]
323 : : {
324 : 18 : nRet = HTMLMODE_ON | HTMLMODE_SOME_STYLES;
325 : 18 : SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
326 [ - + - - ]: 18 : switch ( rHtmlOpt.GetExportMode() )
327 : : {
328 : : case HTML_CFG_MSIE:
329 : : nRet |= HTMLMODE_FULL_STYLES|
330 : 0 : HTMLMODE_SOME_ABS_POS;
331 : 0 : break;
332 : : case HTML_CFG_NS40:
333 : : nRet |= HTMLMODE_FRM_COLUMNS|
334 : 18 : HTMLMODE_SOME_ABS_POS;
335 : 18 : break;
336 : : case HTML_CFG_WRITER:
337 : : nRet |= HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
338 : 0 : HTMLMODE_SOME_ABS_POS;
339 : 18 : break;
340 : : }
341 : : }
342 : 5594 : return nRet;
343 : : }
344 : :
345 : 12417 : Color& SwViewOption::GetDocColor()
346 : : {
347 : 12417 : return aDocColor;
348 : : }
349 : :
350 : 12340 : Color& SwViewOption::GetDocBoundariesColor()
351 : : {
352 : 12340 : return aDocBoundColor;
353 : : }
354 : :
355 : 2734 : Color& SwViewOption::GetObjectBoundariesColor()
356 : : {
357 : 2734 : return aObjectBoundColor;
358 : : }
359 : :
360 : 53446 : Color& SwViewOption::GetAppBackgroundColor()
361 : : {
362 : 53446 : return aAppBackgroundColor;
363 : : }
364 : :
365 : 671 : Color& SwViewOption::GetTableBoundariesColor()
366 : : {
367 : 671 : return aTableBoundColor;
368 : : }
369 : :
370 : 41 : Color& SwViewOption::GetIndexShadingsColor()
371 : : {
372 : 41 : return aIndexShadingsColor;
373 : : }
374 : :
375 : 0 : Color& SwViewOption::GetLinksColor()
376 : : {
377 : 0 : return aLinksColor;
378 : : }
379 : :
380 : 0 : Color& SwViewOption::GetVisitedLinksColor()
381 : : {
382 : 0 : return aVisitedLinksColor;
383 : : }
384 : :
385 : 0 : Color& SwViewOption::GetDirectCursorColor()
386 : : {
387 : 0 : return aDirectCursorColor;
388 : : }
389 : :
390 : 25 : Color& SwViewOption::GetTextGridColor()
391 : : {
392 : 25 : return aTextGridColor;
393 : : }
394 : :
395 : 1754 : Color& SwViewOption::GetSpellColor()
396 : : {
397 : 1754 : return aSpellColor;
398 : : }
399 : :
400 : 0 : Color& SwViewOption::GetSmarttagColor()
401 : : {
402 : 0 : return aSmarttagColor;
403 : : }
404 : :
405 : 12296 : Color& SwViewOption::GetShadowColor()
406 : : {
407 : 12296 : return aShadowColor;
408 : : }
409 : :
410 : 25667 : Color& SwViewOption::GetFontColor()
411 : : {
412 : 25667 : return aFontColor;
413 : : }
414 : :
415 : 2613 : Color& SwViewOption::GetFieldShadingsColor()
416 : : {
417 : 2613 : return aFieldShadingsColor;
418 : : }
419 : :
420 : 566 : Color& SwViewOption::GetSectionBoundColor()
421 : : {
422 : 566 : return aSectionBoundColor;
423 : : }
424 : :
425 : 36 : Color& SwViewOption::GetPageBreakColor()
426 : : {
427 : 36 : return aPageBreakColor;
428 : : }
429 : :
430 : 0 : Color& SwViewOption::GetHeaderFooterMarkColor()
431 : : {
432 : 0 : return aHeaderFooterMarkColor;
433 : : }
434 : :
435 : 121 : void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
436 : : {
437 [ + - ]: 121 : aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
438 : :
439 [ + - ]: 121 : svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
440 : 121 : aDocBoundColor.SetColor(aValue.nColor);
441 : 121 : nAppearanceFlags = 0;
442 [ + - ]: 121 : if(aValue.bIsVisible)
443 : 121 : nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
444 : :
445 [ + - ]: 121 : aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
446 : :
447 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
448 : 121 : aObjectBoundColor.SetColor(aValue.nColor);
449 [ + - ]: 121 : if(aValue.bIsVisible)
450 : 121 : nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
451 : :
452 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
453 : 121 : aTableBoundColor.SetColor(aValue.nColor);
454 [ + + ]: 121 : if(aValue.bIsVisible)
455 : 97 : nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
456 : :
457 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
458 : 121 : aIndexShadingsColor.SetColor(aValue.nColor);
459 [ + - ]: 121 : if(aValue.bIsVisible)
460 : 121 : nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
461 : :
462 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::LINKS);
463 : 121 : aLinksColor.SetColor(aValue.nColor);
464 [ - + ]: 121 : if(aValue.bIsVisible)
465 : 0 : nAppearanceFlags |= VIEWOPT_LINKS;
466 : :
467 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
468 : 121 : aVisitedLinksColor.SetColor(aValue.nColor);
469 [ - + ]: 121 : if(aValue.bIsVisible)
470 : 0 : nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
471 : :
472 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::SHADOWCOLOR);
473 : 121 : aShadowColor.SetColor(aValue.nColor);
474 [ + - ]: 121 : if(aValue.bIsVisible)
475 : 121 : nAppearanceFlags |= VIEWOPT_SHADOW;
476 : :
477 [ + - ]: 121 : aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
478 : :
479 [ + - ]: 121 : aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
480 : :
481 [ + - ]: 121 : aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
482 : :
483 [ + - ]: 121 : aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
484 : :
485 [ + - ]: 121 : aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
486 : :
487 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
488 : 121 : aFieldShadingsColor.SetColor(aValue.nColor);
489 [ + + ]: 121 : if(aValue.bIsVisible)
490 : 97 : nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
491 : :
492 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
493 : 121 : aSectionBoundColor.SetColor(aValue.nColor);
494 [ + - ]: 121 : if(aValue.bIsVisible)
495 : 121 : nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
496 : :
497 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
498 : 121 : aPageBreakColor.SetColor(aValue.nColor);
499 : :
500 [ + - ]: 121 : aValue = rConfig.GetColorValue(svtools::WRITERHEADERFOOTERMARK);
501 : 121 : aHeaderFooterMarkColor.SetColor(aValue.nColor);
502 : :
503 [ + - ]: 121 : aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
504 : 121 : }
505 : :
506 : 30 : void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig )
507 : : {
508 [ + + ]: 30 : if(bSet)
509 : 10 : nAppearanceFlags |= nFlag;
510 : : else
511 : 20 : nAppearanceFlags &= ~nFlag;
512 [ + + ]: 30 : if(bSaveInConfig)
513 : : {
514 : : //create an editable svtools::ColorConfig and store the change
515 [ + - ]: 24 : svtools::EditableColorConfig aEditableConfig;
516 : : struct FlagToConfig_Impl
517 : : {
518 : : sal_Int32 nFlag;
519 : : svtools::ColorConfigEntry eEntry;
520 : : };
521 : : static const FlagToConfig_Impl aFlags[] =
522 : : {
523 : : { VIEWOPT_DOC_BOUNDARIES , svtools::DOCBOUNDARIES },
524 : : { VIEWOPT_OBJECT_BOUNDARIES , svtools::OBJECTBOUNDARIES },
525 : : { VIEWOPT_TABLE_BOUNDARIES , svtools::TABLEBOUNDARIES },
526 : : { VIEWOPT_INDEX_SHADINGS , svtools::WRITERIDXSHADINGS },
527 : : { VIEWOPT_LINKS , svtools::LINKS },
528 : : { VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED },
529 : : { VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS },
530 : : { VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES },
531 : : { VIEWOPT_SHADOW , svtools::SHADOWCOLOR },
532 : : { 0 , svtools::ColorConfigEntryCount }
533 : : };
534 : 24 : sal_uInt16 nPos = 0;
535 [ + + ]: 240 : while(aFlags[nPos].nFlag)
536 : : {
537 [ + + ]: 216 : if(0 != (nFlag&aFlags[nPos].nFlag))
538 : : {
539 [ + - ]: 24 : svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
540 : 24 : aValue.bIsVisible = bSet;
541 [ + - ]: 24 : aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
542 : : }
543 : 216 : nPos++;
544 [ + - ]: 24 : }
545 : : }
546 : 30 : }
547 : :
548 : 63922 : sal_Bool SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
549 : : {
550 : 63922 : return 0 != (nAppearanceFlags & nFlag);
551 [ + - ][ + - ]: 219 : }
552 : :
553 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|