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