update dev300-m58
[ooovba.git] / sw / source / ui / config / viewopt.cxx
blob7430677dbd32341f297874cbe1f713de3aacc0dc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewopt.cxx,v $
10 * $Revision: 1.34 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <svx/htmlmode.hxx>
36 #include <svx/htmlcfg.hxx>
38 #ifndef _SVX_SVXIDS_HRC //autogen
39 #include <svx/svxids.hrc>
40 #endif
41 #include <svx/svxenum.hxx>
42 #include <svx/svxacorr.hxx>
43 #include <unotools/localedatawrapper.hxx>
44 #ifndef _REGION_HXX //autogen
45 #include <vcl/region.hxx>
46 #endif
47 #ifndef _OUTDEV_HXX //autogen
48 #include <vcl/outdev.hxx>
49 #endif
50 #include <vcl/window.hxx>
51 #include <swmodule.hxx>
52 #include <swtypes.hxx>
53 #include <viewopt.hxx>
54 #ifndef _WDOCSH_HXX
55 #include <wdocsh.hxx>
56 #endif
57 #include <swrect.hxx>
58 #include <crstate.hxx>
59 #include <svtools/colorcfg.hxx>
60 #include <svtools/accessibilityoptions.hxx>
61 #include <svtools/syslocale.hxx>
63 #include <svx/acorrcfg.hxx>
65 #ifndef PRODUCT
66 BOOL SwViewOption::bTest9 = FALSE; //DrawingLayerNotLoading
67 #endif
68 Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
69 Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
70 Color SwViewOption::aDocColor(COL_LIGHTGRAY);
71 Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
72 Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
73 Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
74 Color SwViewOption::aLinksColor(COL_BLUE);
75 Color SwViewOption::aVisitedLinksColor(COL_RED);
76 Color SwViewOption::aDirectCursorColor(COL_BLUE);
77 Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
78 Color SwViewOption::aSpellColor(COL_LIGHTRED);
79 Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
80 Color SwViewOption::aFontColor(COL_BLACK);
81 Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
82 Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
83 Color SwViewOption::aPageBreakColor(COL_BLUE);
84 Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
86 sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
87 USHORT SwViewOption::nPixelTwips = 0; //ein Pixel auf dem Bildschirm
90 #define LINEBREAK_SIZE 12, 8
91 #define TAB_SIZE 12, 6
93 #define MIN_BLANKWIDTH 40
94 #define MIN_BLANKHEIGHT 40
95 #define MIN_TABWIDTH 120
96 #define MIN_TABHEIGHT 200
98 static const char __FAR_DATA aPostItStr[] = " ";
100 /*************************************************************************
101 * SwViewOption::IsEqualFlags()
102 *************************************************************************/
104 BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
106 return nCoreOptions == rOpt.nCoreOptions
107 && nCore2Options == rOpt.nCore2Options
108 && aSnapSize == rOpt.aSnapSize
109 && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
110 && nDivisionX == rOpt.GetDivisionX()
111 && nDivisionY == rOpt.GetDivisionY()
112 && nPagePrevRow == rOpt.GetPagePrevRow()
113 && nPagePrevCol == rOpt.GetPagePrevCol()
114 && aRetoucheColor == rOpt.GetRetoucheColor()
115 && bFormView == rOpt.IsFormView()
116 && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
117 && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
118 #ifndef PRODUCT
119 // korrespondieren zu den Angaben in ui/config/cfgvw.src
120 && bTest1 == rOpt.IsTest1()
121 && bTest2 == rOpt.IsTest2()
122 && bTest3 == rOpt.IsTest3()
123 && bTest4 == rOpt.IsTest4()
124 && bTest5 == rOpt.IsTest5()
125 && bTest6 == rOpt.IsTest6()
126 && bTest7 == rOpt.IsTest7()
127 && bTest8 == rOpt.IsTest8()
128 && bTest10 == rOpt.IsTest10()
129 #endif
133 /*************************************************************************
134 * SwViewOption::DrawRect()
135 *************************************************************************/
137 void SwViewOption::DrawRect( OutputDevice *pOut,
138 const SwRect &rRect, long nCol ) const
140 if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
142 const Color aCol( nCol );
143 const Color aOldColor( pOut->GetFillColor() );
144 pOut->SetFillColor( aCol );
145 pOut->DrawRect( rRect.SVRect() );
146 pOut->SetFillColor( aOldColor );
148 else
149 DrawRectPrinter( pOut, rRect );
152 /*************************************************************************
153 * SwViewOption::DrawRectPrinter()
154 *************************************************************************/
156 void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
157 const SwRect &rRect ) const
159 Color aOldColor(pOut->GetLineColor());
160 Color aOldFillColor( pOut->GetFillColor() );
161 pOut->SetLineColor( Color(COL_BLACK) );
162 pOut->SetFillColor( Color(COL_TRANSPARENT ));
163 pOut->DrawRect( rRect.SVRect() );
164 pOut->SetFillColor( aOldFillColor );
165 pOut->SetLineColor( aOldColor );
168 /*************************************************************************
169 * SwViewOption::GetPostItsWidth()
170 *************************************************************************/
172 USHORT SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
174 ASSERT( pOut, "no Outdev" );
175 return USHORT(pOut->GetTextWidth( String::CreateFromAscii(aPostItStr )));
178 /*************************************************************************
179 * SwViewOption::PaintPostIts()
180 *************************************************************************/
182 void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
184 if( pOut && bIsScript )
186 Color aOldLineColor( pOut->GetLineColor() );
187 pOut->SetLineColor( Color(COL_GRAY ) );
188 // Wir ziehen ueberall zwei Pixel ab, damit es schick aussieht
189 USHORT nPix = GetPixelTwips() * 2;
190 if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
191 nPix = 0;
192 const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
193 const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
194 const SwRect aRect( aTopLeft, aBotRight );
195 DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
196 pOut->SetLineColor( aOldLineColor );
201 /*************************************************************************
203 |* ViewOption::ViewOption()
205 |* Letzte Aenderung MA 04. Aug. 93
207 |*************************************************************************/
209 SwViewOption::SwViewOption() :
210 aRetoucheColor( COL_TRANSPARENT ),
211 mnViewLayoutColumns( 0 ),
212 nPagePrevRow( 1 ),
213 nPagePrevCol( 2 ),
214 nShdwCrsrFillMode( FILL_TAB ),
215 bReadonly(FALSE),
216 bStarOneSetting(FALSE),
217 bIsPagePreview(FALSE),
218 bSelectionInReadonly(FALSE),
219 // --> FME 2004-06-29 #114856# Formular view
220 bFormView(FALSE),
221 // <--
222 bBookview(FALSE),
223 mbViewLayoutBookMode(FALSE),
224 bShowPlaceHolderFields( sal_True ),
226 sSymbolFont( RTL_CONSTASCII_USTRINGPARAM( "symbol" ) ),
227 nZoom( 100 ),
228 eZoom( SVX_ZOOM_PERCENT ),
229 nTblDest(TBL_DEST_CELL)
231 // Initialisierung ist jetzt etwas einfacher
232 // alle Bits auf 0
233 nCoreOptions = VIEWOPT_1_IDLE | VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH |
234 VIEWOPT_1_REF |
235 VIEWOPT_1_GRAPHIC |
236 VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL |
237 VIEWOPT_1_PAGEBACK |
238 VIEWOPT_1_SOLIDMARKHDL | VIEWOPT_1_POSTITS;
239 nCore2Options = VIEWOPT_CORE2_BLACKFONT | VIEWOPT_CORE2_HIDDENPARA;
240 nUIOptions = VIEWOPT_2_MODIFIED | VIEWOPT_2_GRFKEEPZOOM |VIEWOPT_2_ANY_RULER;
242 if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
243 aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2"
244 else
245 aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm
246 nDivisionX = nDivisionY = 1;
248 bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
250 #ifndef PRODUCT
251 // korrespondieren zu den Angaben in ui/config/cfgvw.src
252 bTest1 = bTest2 = bTest3 = bTest4 =
253 bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = FALSE;
254 #endif
257 SwViewOption::SwViewOption(const SwViewOption& rVOpt)
259 bReadonly = FALSE;
260 bSelectionInReadonly = FALSE;
261 // --> FME 2004-06-29 #114856# Formular view
262 bFormView = rVOpt.bFormView;
263 // <--
264 nZoom = rVOpt.nZoom ;
265 aSnapSize = rVOpt.aSnapSize ;
266 mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
267 nDivisionX = rVOpt.nDivisionX ;
268 nDivisionY = rVOpt.nDivisionY ;
269 nPagePrevRow = rVOpt.nPagePrevRow;
270 nPagePrevCol = rVOpt.nPagePrevCol;
271 bIsPagePreview = rVOpt.bIsPagePreview;
272 eZoom = rVOpt.eZoom ;
273 nTblDest = rVOpt.nTblDest ;
274 nUIOptions = rVOpt.nUIOptions ;
275 nCoreOptions = rVOpt.nCoreOptions ;
276 nCore2Options = rVOpt.nCore2Options ;
277 aRetoucheColor = rVOpt.GetRetoucheColor();
278 sSymbolFont = rVOpt.sSymbolFont;
279 nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
280 bStarOneSetting = rVOpt.bStarOneSetting;
281 bBookview = rVOpt.bBookview;
282 mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
283 bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
285 #ifndef PRODUCT
286 bTest1 = rVOpt.bTest1 ;
287 bTest2 = rVOpt.bTest2 ;
288 bTest3 = rVOpt.bTest3 ;
289 bTest4 = rVOpt.bTest4 ;
290 bTest5 = rVOpt.bTest5 ;
291 bTest6 = rVOpt.bTest6 ;
292 bTest7 = rVOpt.bTest7 ;
293 bTest8 = rVOpt.bTest8 ;
294 bTest10 = rVOpt.bTest10 ;
295 #endif
299 SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
301 // --> DVO FME 2004-06-29 #114856# Formular view
302 bFormView = rVOpt.bFormView ;
303 // <--
304 nZoom = rVOpt.nZoom ;
305 aSnapSize = rVOpt.aSnapSize ;
306 mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
307 nDivisionX = rVOpt.nDivisionX ;
308 nDivisionY = rVOpt.nDivisionY ;
309 nPagePrevRow = rVOpt.nPagePrevRow;
310 nPagePrevCol = rVOpt.nPagePrevCol;
311 bIsPagePreview = rVOpt.bIsPagePreview;
312 eZoom = rVOpt.eZoom ;
313 nTblDest = rVOpt.nTblDest ;
314 nUIOptions = rVOpt.nUIOptions ;
315 nCoreOptions = rVOpt.nCoreOptions;
316 nCore2Options = rVOpt.nCore2Options;
317 aRetoucheColor = rVOpt.GetRetoucheColor();
318 sSymbolFont = rVOpt.sSymbolFont;
319 nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
320 bStarOneSetting = rVOpt.bStarOneSetting;
321 bBookview = rVOpt.bBookview;
322 mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
323 bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
325 #ifndef PRODUCT
326 bTest1 = rVOpt.bTest1 ;
327 bTest2 = rVOpt.bTest2 ;
328 bTest3 = rVOpt.bTest3 ;
329 bTest4 = rVOpt.bTest4 ;
330 bTest5 = rVOpt.bTest5 ;
331 bTest6 = rVOpt.bTest6 ;
332 bTest7 = rVOpt.bTest7 ;
333 bTest8 = rVOpt.bTest8 ;
334 bTest10 = rVOpt.bTest10 ;
335 #endif
336 return *this;
340 SwViewOption::~SwViewOption()
344 /*************************************************************************
346 |* ViewOption::Init()
348 |* Letzte Aenderung MA 04. Aug. 93
350 |*************************************************************************/
352 void SwViewOption::Init( Window *pWin )
354 if( !nPixelTwips && pWin )
356 nPixelTwips = (USHORT)pWin->PixelToLogic( Size(1,1) ).Height();
360 BOOL SwViewOption::IsAutoCompleteWords() const
362 const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
363 return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords;
366 /*************************************************************************/
367 /* */
368 /*************************************************************************/
370 AuthorCharAttr::AuthorCharAttr() :
371 nItemId (SID_ATTR_CHAR_UNDERLINE),
372 nAttr (UNDERLINE_SINGLE),
373 nColor (COL_TRANSPARENT)
377 /*-----------------07.01.97 13.50-------------------
379 --------------------------------------------------*/
381 USHORT GetHtmlMode(const SwDocShell* pShell)
383 USHORT nRet = 0;
384 if(!pShell || PTR_CAST(SwWebDocShell, pShell))
386 nRet = HTMLMODE_ON;
387 SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
388 switch ( pHtmlOpt->GetExportMode() )
390 case HTML_CFG_MSIE_40:
391 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
392 HTMLMODE_SOME_STYLES|
393 HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS|
394 HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
395 break;
396 case HTML_CFG_NS40:
397 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES|
398 HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS|
399 HTMLMODE_SOME_ABS_POS;
400 break;
401 case HTML_CFG_WRITER:
402 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
403 HTMLMODE_SOME_STYLES|
404 HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
405 HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS|
406 HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
407 break;
408 case HTML_CFG_HTML32:
409 break;
412 return nRet;
414 /* -----------------------------24.04.2002 10:20------------------------------
416 ---------------------------------------------------------------------------*/
417 Color& SwViewOption::GetDocColor()
419 return aDocColor;
421 /* -----------------------------23.04.2002 17:18------------------------------
423 ---------------------------------------------------------------------------*/
424 Color& SwViewOption::GetDocBoundariesColor()
426 return aDocBoundColor;
428 /* -----------------------------23.04.2002 17:53------------------------------
430 ---------------------------------------------------------------------------*/
431 Color& SwViewOption::GetObjectBoundariesColor()
433 return aObjectBoundColor;
435 /* -----------------------------24.04.2002 10:41------------------------------
437 ---------------------------------------------------------------------------*/
438 Color& SwViewOption::GetAppBackgroundColor()
440 return aAppBackgroundColor;
442 /*-- 24.04.2002 10:50:11---------------------------------------------------
444 -----------------------------------------------------------------------*/
445 Color& SwViewOption::GetTableBoundariesColor()
447 return aTableBoundColor;
449 /*-- 24.04.2002 10:50:12---------------------------------------------------
451 -----------------------------------------------------------------------*/
452 Color& SwViewOption::GetIndexShadingsColor()
454 return aIndexShadingsColor;
456 /*-- 24.04.2002 10:50:12---------------------------------------------------
458 -----------------------------------------------------------------------*/
459 Color& SwViewOption::GetLinksColor()
461 return aLinksColor;
463 /*-- 24.04.2002 10:50:13---------------------------------------------------
465 -----------------------------------------------------------------------*/
466 Color& SwViewOption::GetVisitedLinksColor()
468 return aVisitedLinksColor;
470 /*-- 24.04.2002 10:50:13---------------------------------------------------
472 -----------------------------------------------------------------------*/
473 Color& SwViewOption::GetDirectCursorColor()
475 return aDirectCursorColor;
477 /*-- 24.04.2002 10:50:14---------------------------------------------------
479 -----------------------------------------------------------------------*/
480 Color& SwViewOption::GetTextGridColor()
482 return aTextGridColor;
484 /*-- 24.04.2002 10:50:14---------------------------------------------------
486 -----------------------------------------------------------------------*/
487 Color& SwViewOption::GetSpellColor()
489 return aSpellColor;
491 /*-- 24.04.2007 10:50:14---------------------------------------------------
493 -----------------------------------------------------------------------*/
494 Color& SwViewOption::GetSmarttagColor()
496 return aSmarttagColor;
498 /*-- 06.12.2002 10:50:11---------------------------------------------------
500 -----------------------------------------------------------------------*/
501 Color& SwViewOption::GetFontColor()
503 return aFontColor;
505 /*-- 24.04.2002 10:50:15---------------------------------------------------
507 -----------------------------------------------------------------------*/
508 Color& SwViewOption::GetFieldShadingsColor()
510 return aFieldShadingsColor;
512 /*-- 24.04.2002 10:50:15---------------------------------------------------
514 -----------------------------------------------------------------------*/
515 Color& SwViewOption::GetSectionBoundColor()
517 return aSectionBoundColor;
519 /* -----------------------------2002/07/31 14:00------------------------------
521 ---------------------------------------------------------------------------*/
522 Color& SwViewOption::GetPageBreakColor()
524 return aPageBreakColor;
527 /* -----------------------------23.04.2002 17:41------------------------------
529 ---------------------------------------------------------------------------*/
530 void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
532 aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
534 svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
535 aDocBoundColor.SetColor(aValue.nColor);
536 nAppearanceFlags = 0;
537 if(aValue.bIsVisible)
538 nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
540 aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
542 aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
543 aObjectBoundColor.SetColor(aValue.nColor);
544 if(aValue.bIsVisible)
545 nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
547 aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
548 aTableBoundColor.SetColor(aValue.nColor);
549 if(aValue.bIsVisible)
550 nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
552 aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
553 aIndexShadingsColor.SetColor(aValue.nColor);
554 if(aValue.bIsVisible)
555 nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
557 aValue = rConfig.GetColorValue(svtools::LINKS);
558 aLinksColor.SetColor(aValue.nColor);
559 if(aValue.bIsVisible)
560 nAppearanceFlags |= VIEWOPT_LINKS;
562 aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
563 aVisitedLinksColor.SetColor(aValue.nColor);
564 if(aValue.bIsVisible)
565 nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
567 aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
569 aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
571 aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
573 aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
575 aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
577 aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
578 aFieldShadingsColor.SetColor(aValue.nColor);
579 if(aValue.bIsVisible)
580 nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
582 aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
583 aSectionBoundColor.SetColor(aValue.nColor);
584 if(aValue.bIsVisible)
585 nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
587 aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
588 aPageBreakColor.SetColor(aValue.nColor);
590 aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
592 /* -----------------------------23.04.2002 17:48------------------------------
594 ---------------------------------------------------------------------------*/
595 void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, BOOL bSet, BOOL bSaveInConfig )
597 if(bSet)
598 nAppearanceFlags |= nFlag;
599 else
600 nAppearanceFlags &= ~nFlag;
601 if(bSaveInConfig)
603 //create an editable svtools::ColorConfig and store the change
604 svtools::EditableColorConfig aEditableConfig;
605 struct FlagToConfig_Impl
607 sal_Int32 nFlag;
608 svtools::ColorConfigEntry eEntry;
610 static const FlagToConfig_Impl aFlags[] =
612 { VIEWOPT_DOC_BOUNDARIES , svtools::DOCBOUNDARIES },
613 { VIEWOPT_OBJECT_BOUNDARIES , svtools::OBJECTBOUNDARIES },
614 { VIEWOPT_TABLE_BOUNDARIES , svtools::TABLEBOUNDARIES },
615 { VIEWOPT_INDEX_SHADINGS , svtools::WRITERIDXSHADINGS },
616 { VIEWOPT_LINKS , svtools::LINKS },
617 { VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED },
618 { VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS },
619 { VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES },
620 { 0 , svtools::ColorConfigEntryCount }
622 sal_uInt16 nPos = 0;
623 while(aFlags[nPos].nFlag)
625 if(0 != (nFlag&aFlags[nPos].nFlag))
627 svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
628 aValue.bIsVisible = bSet;
629 aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
631 nPos++;
635 /* -----------------------------24.04.2002 10:42------------------------------
637 ---------------------------------------------------------------------------*/
638 BOOL SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
640 return 0 != (nAppearanceFlags & nFlag);