1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26
27
28 #include <svx/htmlmode.hxx>
29 #include <svtools/htmlcfg.hxx>
30
31 #ifndef _SVX_SVXIDS_HRC //autogen
32 #include <svx/svxids.hrc>
33 #endif
34 #include <editeng/svxenum.hxx>
35 #include <editeng/svxacorr.hxx>
36 #include <unotools/localedatawrapper.hxx>
37 #ifndef _REGION_HXX //autogen
38 #include <vcl/region.hxx>
39 #endif
40 #ifndef _OUTDEV_HXX //autogen
41 #include <vcl/outdev.hxx>
42 #endif
43 #include <vcl/window.hxx>
44 #include <swmodule.hxx>
45 #include <swtypes.hxx>
46 #include <viewopt.hxx>
47 #ifndef _WDOCSH_HXX
48 #include <wdocsh.hxx>
49 #endif
50 #include <swrect.hxx>
51 #include <crstate.hxx>
52 #include <svtools/colorcfg.hxx>
53 #include <svtools/accessibilityoptions.hxx>
54 #include <unotools/syslocale.hxx>
55
56 #include <editeng/acorrcfg.hxx>
57
58 #ifdef DBG_UTIL
59 sal_Bool SwViewOption::bTest9 = sal_False; //DrawingLayerNotLoading
60 #endif
61 Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
62 Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
63 Color SwViewOption::aDocColor(COL_LIGHTGRAY);
64 Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
65 Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
66 Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
67 Color SwViewOption::aLinksColor(COL_BLUE);
68 Color SwViewOption::aVisitedLinksColor(COL_RED);
69 Color SwViewOption::aDirectCursorColor(COL_BLUE);
70 Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
71 Color SwViewOption::aSpellColor(COL_LIGHTRED);
72 Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
73 Color SwViewOption::aFontColor(COL_BLACK);
74 Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
75 Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
76 Color SwViewOption::aPageBreakColor(COL_BLUE);
77 Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
78
79 sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
80 sal_uInt16 SwViewOption::nPixelTwips = 0; //ein Pixel auf dem Bildschirm
81
82
83 #define LINEBREAK_SIZE 12, 8
84 #define TAB_SIZE 12, 6
85
86 #define MIN_BLANKWIDTH 40
87 #define MIN_BLANKHEIGHT 40
88 #define MIN_TABWIDTH 120
89 #define MIN_TABHEIGHT 200
90
91 static const char __FAR_DATA aPostItStr[] = " ";
92
93 /*************************************************************************
94 * SwViewOption::IsEqualFlags()
95 *************************************************************************/
96
IsEqualFlags(const SwViewOption & rOpt) const97 sal_Bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
98 {
99 return nCoreOptions == rOpt.nCoreOptions
100 && nCore2Options == rOpt.nCore2Options
101 && aSnapSize == rOpt.aSnapSize
102 && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
103 && nDivisionX == rOpt.GetDivisionX()
104 && nDivisionY == rOpt.GetDivisionY()
105 && nPagePrevRow == rOpt.GetPagePrevRow()
106 && nPagePrevCol == rOpt.GetPagePrevCol()
107 && aRetoucheColor == rOpt.GetRetoucheColor()
108 && mbFormView == rOpt.IsFormView()
109 && mbBrowseMode == rOpt.getBrowseMode()
110 && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
111 && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
112 && bIdle == rOpt.bIdle
113 #ifdef DBG_UTIL
114 // korrespondieren zu den Angaben in ui/config/cfgvw.src
115 && bTest1 == rOpt.IsTest1()
116 && bTest2 == rOpt.IsTest2()
117 && bTest3 == rOpt.IsTest3()
118 && bTest4 == rOpt.IsTest4()
119 && bTest5 == rOpt.IsTest5()
120 && bTest6 == rOpt.IsTest6()
121 && bTest7 == rOpt.IsTest7()
122 && bTest8 == rOpt.IsTest8()
123 && bTest10 == rOpt.IsTest10()
124 #endif
125 ;
126 }
127
128 /*************************************************************************
129 * SwViewOption::DrawRect()
130 *************************************************************************/
131
DrawRect(OutputDevice * pOut,const SwRect & rRect,long nCol) const132 void SwViewOption::DrawRect( OutputDevice *pOut,
133 const SwRect &rRect, long nCol ) const
134 {
135 if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
136 {
137 const Color aCol( nCol );
138 const Color aOldColor( pOut->GetFillColor() );
139 pOut->SetFillColor( aCol );
140 pOut->DrawRect( rRect.SVRect() );
141 pOut->SetFillColor( aOldColor );
142 }
143 else
144 DrawRectPrinter( pOut, rRect );
145 }
146
147 /*************************************************************************
148 * SwViewOption::DrawRectPrinter()
149 *************************************************************************/
150
DrawRectPrinter(OutputDevice * pOut,const SwRect & rRect) const151 void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
152 const SwRect &rRect ) const
153 {
154 Color aOldColor(pOut->GetLineColor());
155 Color aOldFillColor( pOut->GetFillColor() );
156 pOut->SetLineColor( Color(COL_BLACK) );
157 pOut->SetFillColor( Color(COL_TRANSPARENT ));
158 pOut->DrawRect( rRect.SVRect() );
159 pOut->SetFillColor( aOldFillColor );
160 pOut->SetLineColor( aOldColor );
161 }
162
163 /*************************************************************************
164 * SwViewOption::GetPostItsWidth()
165 *************************************************************************/
166
GetPostItsWidth(const OutputDevice * pOut) const167 sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
168 {
169 ASSERT( pOut, "no Outdev" );
170 return sal_uInt16(pOut->GetTextWidth( String::CreateFromAscii(aPostItStr )));
171 }
172
173 /*************************************************************************
174 * SwViewOption::PaintPostIts()
175 *************************************************************************/
176
PaintPostIts(OutputDevice * pOut,const SwRect & rRect,sal_Bool bIsScript) const177 void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
178 {
179 if( pOut && bIsScript )
180 {
181 Color aOldLineColor( pOut->GetLineColor() );
182 pOut->SetLineColor( Color(COL_GRAY ) );
183 // Wir ziehen ueberall zwei Pixel ab, damit es schick aussieht
184 sal_uInt16 nPix = GetPixelTwips() * 2;
185 if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
186 nPix = 0;
187 const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
188 const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
189 const SwRect aRect( aTopLeft, aBotRight );
190 DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
191 pOut->SetLineColor( aOldLineColor );
192 }
193 }
194
195
196 /*************************************************************************
197 |*
198 |* ViewOption::ViewOption()
199 |*
200 |* Letzte Aenderung MA 04. Aug. 93
201 |*
202 |*************************************************************************/
203
SwViewOption()204 SwViewOption::SwViewOption() :
205 aRetoucheColor( COL_TRANSPARENT ),
206 mnViewLayoutColumns( 0 ),
207 nPagePrevRow( 1 ),
208 nPagePrevCol( 2 ),
209 nShdwCrsrFillMode( FILL_TAB ),
210 bReadonly(sal_False),
211 bStarOneSetting(sal_False),
212 bIsPagePreview(sal_False),
213 bSelectionInReadonly(sal_False),
214 mbFormView(sal_False),
215 mbBrowseMode(sal_False),
216 mbBookView(sal_False),
217 mbViewLayoutBookMode(sal_False),
218 bShowPlaceHolderFields( sal_True ),
219
220 nZoom( 100 ),
221 eZoom( SVX_ZOOM_PERCENT ),
222 nTblDest(TBL_DEST_CELL)
223 {
224 // Initialisierung ist jetzt etwas einfacher
225 // alle Bits auf 0
226 nCoreOptions =
227 VIEWOPT_1_HARDBLANK |
228 VIEWOPT_1_SOFTHYPH |
229 VIEWOPT_1_REF |
230 VIEWOPT_1_GRAPHIC |
231 VIEWOPT_1_TABLE |
232 VIEWOPT_1_DRAW |
233 VIEWOPT_1_CONTROL |
234 VIEWOPT_1_PAGEBACK |
235 VIEWOPT_1_SOLIDMARKHDL | // default is enhanced handles
236 VIEWOPT_1_POSTITS;
237
238 nCore2Options =
239 VIEWOPT_CORE2_BLACKFONT |
240 VIEWOPT_CORE2_HIDDENPARA |
241 VIEWOPT_CORE2_BIGMARKHDL; // default is big handles
242
243 nUIOptions =
244 VIEWOPT_2_MODIFIED |
245 VIEWOPT_2_GRFKEEPZOOM |
246 VIEWOPT_2_ANY_RULER;
247
248 if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
249 aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2"
250 else
251 aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm
252 nDivisionX = nDivisionY = 1;
253
254 bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
255
256 bIdle = true;
257
258 #ifdef DBG_UTIL
259 // korrespondieren zu den Angaben in ui/config/cfgvw.src
260 bTest1 = bTest2 = bTest3 = bTest4 =
261 bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = sal_False;
262 #endif
263 }
264
SwViewOption(const SwViewOption & rVOpt)265 SwViewOption::SwViewOption(const SwViewOption& rVOpt)
266 {
267 bReadonly = sal_False;
268 bSelectionInReadonly = sal_False;
269 // --> FME 2004-06-29 #114856# Formular view
270 mbFormView = rVOpt.mbFormView;
271 // <--
272 nZoom = rVOpt.nZoom ;
273 aSnapSize = rVOpt.aSnapSize ;
274 mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
275 nDivisionX = rVOpt.nDivisionX ;
276 nDivisionY = rVOpt.nDivisionY ;
277 nPagePrevRow = rVOpt.nPagePrevRow;
278 nPagePrevCol = rVOpt.nPagePrevCol;
279 bIsPagePreview = rVOpt.bIsPagePreview;
280 eZoom = rVOpt.eZoom ;
281 nTblDest = rVOpt.nTblDest ;
282 nUIOptions = rVOpt.nUIOptions ;
283 nCoreOptions = rVOpt.nCoreOptions ;
284 nCore2Options = rVOpt.nCore2Options ;
285 aRetoucheColor = rVOpt.GetRetoucheColor();
286 sSymbolFont = rVOpt.sSymbolFont;
287 nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
288 bStarOneSetting = rVOpt.bStarOneSetting;
289 mbBookView = rVOpt.mbBookView;
290 mbBrowseMode = rVOpt.mbBrowseMode;
291 mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
292 bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
293 bIdle = rVOpt.bIdle;
294
295 #ifdef DBG_UTIL
296 bTest1 = rVOpt.bTest1 ;
297 bTest2 = rVOpt.bTest2 ;
298 bTest3 = rVOpt.bTest3 ;
299 bTest4 = rVOpt.bTest4 ;
300 bTest5 = rVOpt.bTest5 ;
301 bTest6 = rVOpt.bTest6 ;
302 bTest7 = rVOpt.bTest7 ;
303 bTest8 = rVOpt.bTest8 ;
304 bTest10 = rVOpt.bTest10 ;
305 #endif
306 }
307
308
operator =(const SwViewOption & rVOpt)309 SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
310 {
311 // --> DVO FME 2004-06-29 #114856# Formular view
312 mbFormView = rVOpt.mbFormView ;
313 // <--
314 nZoom = rVOpt.nZoom ;
315 aSnapSize = rVOpt.aSnapSize ;
316 mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
317 nDivisionX = rVOpt.nDivisionX ;
318 nDivisionY = rVOpt.nDivisionY ;
319 nPagePrevRow = rVOpt.nPagePrevRow;
320 nPagePrevCol = rVOpt.nPagePrevCol;
321 bIsPagePreview = rVOpt.bIsPagePreview;
322 eZoom = rVOpt.eZoom ;
323 nTblDest = rVOpt.nTblDest ;
324 nUIOptions = rVOpt.nUIOptions ;
325 nCoreOptions = rVOpt.nCoreOptions;
326 nCore2Options = rVOpt.nCore2Options;
327 aRetoucheColor = rVOpt.GetRetoucheColor();
328 sSymbolFont = rVOpt.sSymbolFont;
329 nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
330 bStarOneSetting = rVOpt.bStarOneSetting;
331 mbBookView = rVOpt.mbBookView;
332 mbBrowseMode = rVOpt.mbBrowseMode;
333 mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
334 bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
335 bIdle = rVOpt.bIdle;
336
337 #ifdef DBG_UTIL
338 bTest1 = rVOpt.bTest1 ;
339 bTest2 = rVOpt.bTest2 ;
340 bTest3 = rVOpt.bTest3 ;
341 bTest4 = rVOpt.bTest4 ;
342 bTest5 = rVOpt.bTest5 ;
343 bTest6 = rVOpt.bTest6 ;
344 bTest7 = rVOpt.bTest7 ;
345 bTest8 = rVOpt.bTest8 ;
346 bTest10 = rVOpt.bTest10 ;
347 #endif
348 return *this;
349 }
350
351
~SwViewOption()352 SwViewOption::~SwViewOption()
353 {
354 }
355
356 /*************************************************************************
357 |*
358 |* ViewOption::Init()
359 |*
360 |* Letzte Aenderung MA 04. Aug. 93
361 |*
362 |*************************************************************************/
363
Init(Window * pWin)364 void SwViewOption::Init( Window *pWin )
365 {
366 if( !nPixelTwips && pWin )
367 {
368 nPixelTwips = (sal_uInt16)pWin->PixelToLogic( Size(1,1) ).Height();
369 }
370 }
371
IsAutoCompleteWords() const372 sal_Bool SwViewOption::IsAutoCompleteWords() const
373 {
374 const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
375 return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords;
376 }
377
378 /*************************************************************************/
379 /* */
380 /*************************************************************************/
381
AuthorCharAttr()382 AuthorCharAttr::AuthorCharAttr() :
383 nItemId (SID_ATTR_CHAR_UNDERLINE),
384 nAttr (UNDERLINE_SINGLE),
385 nColor (COL_TRANSPARENT)
386 {
387 }
388
389 /*-----------------07.01.97 13.50-------------------
390
391 --------------------------------------------------*/
392
GetHtmlMode(const SwDocShell * pShell)393 sal_uInt16 GetHtmlMode(const SwDocShell* pShell)
394 {
395 sal_uInt16 nRet = 0;
396 if(!pShell || PTR_CAST(SwWebDocShell, pShell))
397 {
398 nRet = HTMLMODE_ON;
399 SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
400 switch ( pHtmlOpt->GetExportMode() )
401 {
402 case HTML_CFG_MSIE_40:
403 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
404 HTMLMODE_SOME_STYLES|
405 HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS|
406 HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
407 break;
408 case HTML_CFG_NS40:
409 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES|
410 HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS|
411 HTMLMODE_SOME_ABS_POS;
412 break;
413 case HTML_CFG_WRITER:
414 nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
415 HTMLMODE_SOME_STYLES|
416 HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
417 HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS|
418 HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
419 break;
420 case HTML_CFG_HTML32:
421 break;
422 }
423 }
424 return nRet;
425 }
426 /* -----------------------------24.04.2002 10:20------------------------------
427
428 ---------------------------------------------------------------------------*/
GetDocColor()429 Color& SwViewOption::GetDocColor()
430 {
431 return aDocColor;
432 }
433 /* -----------------------------23.04.2002 17:18------------------------------
434
435 ---------------------------------------------------------------------------*/
GetDocBoundariesColor()436 Color& SwViewOption::GetDocBoundariesColor()
437 {
438 return aDocBoundColor;
439 }
440 /* -----------------------------23.04.2002 17:53------------------------------
441
442 ---------------------------------------------------------------------------*/
GetObjectBoundariesColor()443 Color& SwViewOption::GetObjectBoundariesColor()
444 {
445 return aObjectBoundColor;
446 }
447 /* -----------------------------24.04.2002 10:41------------------------------
448
449 ---------------------------------------------------------------------------*/
GetAppBackgroundColor()450 Color& SwViewOption::GetAppBackgroundColor()
451 {
452 return aAppBackgroundColor;
453 }
454 /*-- 24.04.2002 10:50:11---------------------------------------------------
455
456 -----------------------------------------------------------------------*/
GetTableBoundariesColor()457 Color& SwViewOption::GetTableBoundariesColor()
458 {
459 return aTableBoundColor;
460 }
461 /*-- 24.04.2002 10:50:12---------------------------------------------------
462
463 -----------------------------------------------------------------------*/
GetIndexShadingsColor()464 Color& SwViewOption::GetIndexShadingsColor()
465 {
466 return aIndexShadingsColor;
467 }
468 /*-- 24.04.2002 10:50:12---------------------------------------------------
469
470 -----------------------------------------------------------------------*/
GetLinksColor()471 Color& SwViewOption::GetLinksColor()
472 {
473 return aLinksColor;
474 }
475 /*-- 24.04.2002 10:50:13---------------------------------------------------
476
477 -----------------------------------------------------------------------*/
GetVisitedLinksColor()478 Color& SwViewOption::GetVisitedLinksColor()
479 {
480 return aVisitedLinksColor;
481 }
482 /*-- 24.04.2002 10:50:13---------------------------------------------------
483
484 -----------------------------------------------------------------------*/
GetDirectCursorColor()485 Color& SwViewOption::GetDirectCursorColor()
486 {
487 return aDirectCursorColor;
488 }
489 /*-- 24.04.2002 10:50:14---------------------------------------------------
490
491 -----------------------------------------------------------------------*/
GetTextGridColor()492 Color& SwViewOption::GetTextGridColor()
493 {
494 return aTextGridColor;
495 }
496 /*-- 24.04.2002 10:50:14---------------------------------------------------
497
498 -----------------------------------------------------------------------*/
GetSpellColor()499 Color& SwViewOption::GetSpellColor()
500 {
501 return aSpellColor;
502 }
503 /*-- 24.04.2007 10:50:14---------------------------------------------------
504
505 -----------------------------------------------------------------------*/
GetSmarttagColor()506 Color& SwViewOption::GetSmarttagColor()
507 {
508 return aSmarttagColor;
509 }
510 /*-- 06.12.2002 10:50:11---------------------------------------------------
511
512 -----------------------------------------------------------------------*/
GetFontColor()513 Color& SwViewOption::GetFontColor()
514 {
515 return aFontColor;
516 }
517 /*-- 24.04.2002 10:50:15---------------------------------------------------
518
519 -----------------------------------------------------------------------*/
GetFieldShadingsColor()520 Color& SwViewOption::GetFieldShadingsColor()
521 {
522 return aFieldShadingsColor;
523 }
524 /*-- 24.04.2002 10:50:15---------------------------------------------------
525
526 -----------------------------------------------------------------------*/
GetSectionBoundColor()527 Color& SwViewOption::GetSectionBoundColor()
528 {
529 return aSectionBoundColor;
530 }
531 /* -----------------------------2002/07/31 14:00------------------------------
532
533 ---------------------------------------------------------------------------*/
GetPageBreakColor()534 Color& SwViewOption::GetPageBreakColor()
535 {
536 return aPageBreakColor;
537 }
538
539 /* -----------------------------23.04.2002 17:41------------------------------
540
541 ---------------------------------------------------------------------------*/
ApplyColorConfigValues(const svtools::ColorConfig & rConfig)542 void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
543 {
544 aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
545
546 svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
547 aDocBoundColor.SetColor(aValue.nColor);
548 nAppearanceFlags = 0;
549 if(aValue.bIsVisible)
550 nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
551
552 aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
553
554 aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
555 aObjectBoundColor.SetColor(aValue.nColor);
556 if(aValue.bIsVisible)
557 nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
558
559 aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
560 aTableBoundColor.SetColor(aValue.nColor);
561 if(aValue.bIsVisible)
562 nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
563
564 aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
565 aIndexShadingsColor.SetColor(aValue.nColor);
566 if(aValue.bIsVisible)
567 nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
568
569 aValue = rConfig.GetColorValue(svtools::LINKS);
570 aLinksColor.SetColor(aValue.nColor);
571 if(aValue.bIsVisible)
572 nAppearanceFlags |= VIEWOPT_LINKS;
573
574 aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
575 aVisitedLinksColor.SetColor(aValue.nColor);
576 if(aValue.bIsVisible)
577 nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
578
579 aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
580
581 aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
582
583 aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
584
585 aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
586
587 aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
588
589 aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
590 aFieldShadingsColor.SetColor(aValue.nColor);
591 if(aValue.bIsVisible)
592 nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
593
594 aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
595 aSectionBoundColor.SetColor(aValue.nColor);
596 if(aValue.bIsVisible)
597 nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
598
599 aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
600 aPageBreakColor.SetColor(aValue.nColor);
601
602 aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
603 }
604 /* -----------------------------23.04.2002 17:48------------------------------
605
606 ---------------------------------------------------------------------------*/
SetAppearanceFlag(sal_Int32 nFlag,sal_Bool bSet,sal_Bool bSaveInConfig)607 void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, sal_Bool bSet, sal_Bool bSaveInConfig )
608 {
609 if(bSet)
610 nAppearanceFlags |= nFlag;
611 else
612 nAppearanceFlags &= ~nFlag;
613 if(bSaveInConfig)
614 {
615 //create an editable svtools::ColorConfig and store the change
616 svtools::EditableColorConfig aEditableConfig;
617 struct FlagToConfig_Impl
618 {
619 sal_Int32 nFlag;
620 svtools::ColorConfigEntry eEntry;
621 };
622 static const FlagToConfig_Impl aFlags[] =
623 {
624 { VIEWOPT_DOC_BOUNDARIES , svtools::DOCBOUNDARIES },
625 { VIEWOPT_OBJECT_BOUNDARIES , svtools::OBJECTBOUNDARIES },
626 { VIEWOPT_TABLE_BOUNDARIES , svtools::TABLEBOUNDARIES },
627 { VIEWOPT_INDEX_SHADINGS , svtools::WRITERIDXSHADINGS },
628 { VIEWOPT_LINKS , svtools::LINKS },
629 { VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED },
630 { VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS },
631 { VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES },
632 { 0 , svtools::ColorConfigEntryCount }
633 };
634 sal_uInt16 nPos = 0;
635 while(aFlags[nPos].nFlag)
636 {
637 if(0 != (nFlag&aFlags[nPos].nFlag))
638 {
639 svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
640 aValue.bIsVisible = bSet;
641 aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
642 }
643 nPos++;
644 }
645 }
646 }
647 /* -----------------------------24.04.2002 10:42------------------------------
648
649 ---------------------------------------------------------------------------*/
IsAppearanceFlag(sal_Int32 nFlag)650 sal_Bool SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
651 {
652 return 0 != (nAppearanceFlags & nFlag);
653 }
654
655