1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sfx2/htmlmode.hxx>
21 #include <svtools/htmlcfg.hxx>
23 #include <editeng/editids.hrc>
24 #include <editeng/svxacorr.hxx>
25 #include <officecfg/Office/Common.hxx>
26 #include <unotools/localedatawrapper.hxx>
27 #include <vcl/outdev.hxx>
28 #include <swmodule.hxx>
29 #include <viewopt.hxx>
35 #include <crstate.hxx>
36 #include <authratr.hxx>
37 #include <svtools/colorcfg.hxx>
38 #include <svtools/accessibilityoptions.hxx>
39 #include <unotools/configmgr.hxx>
40 #include <unotools/syslocale.hxx>
42 #include <editeng/acorrcfg.hxx>
43 #include <comphelper/lok.hxx>
44 #include <comphelper/configurationlistener.hxx>
46 sal_uInt16
SwViewOption::s_nPixelTwips
= 0; // one pixel on the screen
47 SwViewColors
SwViewOption::s_aInitialColorConfig
{};
49 SwViewColors::SwViewColors() :
50 m_aDocColor(COL_LIGHTGRAY
),
51 m_aDocBoundColor(COL_LIGHTGRAY
),
52 m_aObjectBoundColor(COL_LIGHTGRAY
),
53 m_aAppBackgroundColor(COL_LIGHTGRAY
),
54 m_aTableBoundColor(COL_LIGHTGRAY
),
55 m_aFontColor(COL_BLACK
),
56 m_aIndexShadingsColor(COL_LIGHTGRAY
),
57 m_aLinksColor(COL_BLUE
),
58 m_aVisitedLinksColor(COL_RED
),
59 m_aDirectCursorColor(COL_BLUE
),
60 m_aTextGridColor(COL_LIGHTGRAY
),
61 m_aSpellColor(COL_LIGHTRED
),
62 m_aGrammarColor(COL_LIGHTBLUE
),
63 m_aSmarttagColor(COL_LIGHTMAGENTA
),
64 m_aFieldShadingsColor(COL_LIGHTGRAY
),
65 m_aSectionBoundColor(COL_LIGHTGRAY
),
66 m_aPageBreakColor(COL_BLUE
),
67 m_aScriptIndicatorColor(COL_GREEN
),
68 m_aShadowColor(COL_GRAY
),
69 m_aHeaderFooterMarkColor(COL_BLUE
),
70 m_nAppearanceFlags(ViewOptFlags::NONE
)
73 SwViewColors::SwViewColors(const svtools::ColorConfig
& rConfig
)
75 m_aDocColor
= rConfig
.GetColorValue(svtools::DOCCOLOR
).nColor
;
77 svtools::ColorConfigValue aValue
= rConfig
.GetColorValue(svtools::DOCBOUNDARIES
);
78 m_aDocBoundColor
= aValue
.nColor
;
79 m_nAppearanceFlags
= ViewOptFlags::NONE
;
81 m_nAppearanceFlags
|= ViewOptFlags::DocBoundaries
;
83 m_aAppBackgroundColor
= rConfig
.GetColorValue(svtools::APPBACKGROUND
).nColor
;
85 aValue
= rConfig
.GetColorValue(svtools::OBJECTBOUNDARIES
);
86 m_aObjectBoundColor
= aValue
.nColor
;
88 m_nAppearanceFlags
|= ViewOptFlags::ObjectBoundaries
;
90 aValue
= rConfig
.GetColorValue(svtools::TABLEBOUNDARIES
);
91 m_aTableBoundColor
= aValue
.nColor
;
93 m_nAppearanceFlags
|= ViewOptFlags::TableBoundaries
;
95 aValue
= rConfig
.GetColorValue(svtools::WRITERIDXSHADINGS
);
96 m_aIndexShadingsColor
= aValue
.nColor
;
98 m_nAppearanceFlags
|= ViewOptFlags::IndexShadings
;
100 aValue
= rConfig
.GetColorValue(svtools::LINKS
);
101 m_aLinksColor
= aValue
.nColor
;
102 if(aValue
.bIsVisible
)
103 m_nAppearanceFlags
|= ViewOptFlags::Links
;
105 aValue
= rConfig
.GetColorValue(svtools::LINKSVISITED
);
106 m_aVisitedLinksColor
= aValue
.nColor
;
107 if(aValue
.bIsVisible
)
108 m_nAppearanceFlags
|= ViewOptFlags::VisitedLinks
;
110 aValue
= rConfig
.GetColorValue(svtools::SHADOWCOLOR
);
111 m_aShadowColor
= aValue
.nColor
;
112 if(aValue
.bIsVisible
)
113 m_nAppearanceFlags
|= ViewOptFlags::Shadow
;
115 m_aDirectCursorColor
= rConfig
.GetColorValue(svtools::WRITERDIRECTCURSOR
).nColor
;
117 m_aTextGridColor
= rConfig
.GetColorValue(svtools::WRITERTEXTGRID
).nColor
;
119 m_aSpellColor
= rConfig
.GetColorValue(svtools::SPELL
).nColor
;
120 m_aGrammarColor
= rConfig
.GetColorValue(svtools::GRAMMAR
).nColor
;
122 m_aSmarttagColor
= rConfig
.GetColorValue(svtools::SMARTTAGS
).nColor
;
124 m_aFontColor
= rConfig
.GetColorValue(svtools::FONTCOLOR
).nColor
;
126 aValue
= rConfig
.GetColorValue(svtools::WRITERFIELDSHADINGS
);
127 m_aFieldShadingsColor
= aValue
.nColor
;
128 // as in initializeForTiledRendering we don't want to enable
129 // field shadings for the online case
130 if (aValue
.bIsVisible
&& !comphelper::LibreOfficeKit::isActive())
131 m_nAppearanceFlags
|= ViewOptFlags::FieldShadings
;
133 aValue
= rConfig
.GetColorValue(svtools::WRITERSECTIONBOUNDARIES
);
134 m_aSectionBoundColor
= aValue
.nColor
;
135 if(aValue
.bIsVisible
)
136 m_nAppearanceFlags
|= ViewOptFlags::SectionBoundaries
;
138 aValue
= rConfig
.GetColorValue(svtools::WRITERPAGEBREAKS
);
139 m_aPageBreakColor
= aValue
.nColor
;
141 aValue
= rConfig
.GetColorValue(svtools::WRITERHEADERFOOTERMARK
);
142 m_aHeaderFooterMarkColor
= aValue
.nColor
;
144 m_aScriptIndicatorColor
= rConfig
.GetColorValue(svtools::WRITERSCRIPTINDICATOR
).nColor
;
147 bool SwViewOption::IsEqualFlags( const SwViewOption
&rOpt
) const
149 return m_nCoreOptions
== rOpt
.m_nCoreOptions
150 && m_nCore2Options
== rOpt
.m_nCore2Options
151 && m_aSnapSize
== rOpt
.m_aSnapSize
152 && mnViewLayoutColumns
== rOpt
.mnViewLayoutColumns
153 && m_nDivisionX
== rOpt
.GetDivisionX()
154 && m_nDivisionY
== rOpt
.GetDivisionY()
155 && m_nPagePreviewRow
== rOpt
.GetPagePrevRow()
156 && m_nPagePreviewCol
== rOpt
.GetPagePrevCol()
157 && m_aRetouchColor
== rOpt
.GetRetoucheColor()
158 && mbFormView
== rOpt
.IsFormView()
159 && mbBrowseMode
== rOpt
.getBrowseMode()
160 && mbViewLayoutBookMode
== rOpt
.mbViewLayoutBookMode
161 && mbHideWhitespaceMode
== rOpt
.mbHideWhitespaceMode
162 && m_bShowPlaceHolderFields
== rOpt
.m_bShowPlaceHolderFields
163 && m_bIdle
== rOpt
.m_bIdle
164 && m_nDefaultAnchor
== rOpt
.m_nDefaultAnchor
166 // correspond to the statements in ui/config/cfgvw.src
167 && m_bTest1
== rOpt
.IsTest1()
168 && m_bTest2
== rOpt
.IsTest2()
169 && m_bTest3
== rOpt
.IsTest3()
170 && m_bTest4
== rOpt
.IsTest4()
171 && m_bTest5
== rOpt
.IsTest5()
172 && m_bTest6
== rOpt
.IsTest6()
173 && m_bTest7
== rOpt
.IsTest7()
174 && m_bTest8
== rOpt
.IsTest8()
175 && m_bTest10
== rOpt
.IsTest10()
180 bool SwViewOption::IsShowOutlineContentVisibilityButton() const
182 return m_nCoreOptions
.bShowOutlineContentVisibilityButton
;
185 bool SwViewOption::IsTreatSubOutlineLevelsAsContent() const
187 return m_nCoreOptions
.bTreatSubOutlineLevelsAsContent
;
190 void SwViewOption::DrawRect( OutputDevice
*pOut
,
191 const SwRect
&rRect
, ::Color nCol
)
193 if ( pOut
->GetOutDevType() != OUTDEV_PRINTER
)
195 const Color
aCol( nCol
);
196 const Color
aOldColor( pOut
->GetFillColor() );
197 pOut
->SetFillColor( aCol
);
198 pOut
->DrawRect( rRect
.SVRect() );
199 pOut
->SetFillColor( aOldColor
);
202 DrawRectPrinter( pOut
, rRect
);
205 void SwViewOption::DrawRectPrinter( OutputDevice
*pOut
,
206 const SwRect
&rRect
)
208 Color
aOldColor(pOut
->GetLineColor());
209 Color
aOldFillColor( pOut
->GetFillColor() );
210 pOut
->SetLineColor( COL_BLACK
);
211 pOut
->SetFillColor( COL_TRANSPARENT
);
212 pOut
->DrawRect( rRect
.SVRect() );
213 pOut
->SetFillColor( aOldFillColor
);
214 pOut
->SetLineColor( aOldColor
);
217 sal_uInt16
SwViewOption::GetPostItsWidth( const OutputDevice
*pOut
)
219 assert(pOut
&& "no Outdev");
220 return sal_uInt16(pOut
->GetTextWidth(" "));
223 void SwViewOption::PaintPostIts( OutputDevice
*pOut
, const SwRect
&rRect
, bool bIsScript
) const
225 if( !(pOut
&& bIsScript
) )
228 Color
aOldLineColor( pOut
->GetLineColor() );
229 pOut
->SetLineColor( COL_GRAY
);
230 // to make it look nice, we subtract two pixels everywhere
231 sal_uInt16 nPix
= s_nPixelTwips
* 2;
232 if( rRect
.Width() <= 2 * nPix
|| rRect
.Height() <= 2 * nPix
)
234 const Point
aTopLeft( rRect
.Left() + nPix
, rRect
.Top() + nPix
);
235 const Point
aBotRight( rRect
.Right() - nPix
, rRect
.Bottom() - nPix
);
236 const SwRect
aRect( aTopLeft
, aBotRight
);
237 DrawRect( pOut
, aRect
, m_aColorConfig
.m_aScriptIndicatorColor
);
238 pOut
->SetLineColor( aOldLineColor
);
241 SwViewOption::SwViewOption() :
242 m_sThemeName( "Default" ),
243 m_sSymbolFont( "symbol" ),
244 m_aRetouchColor( COL_TRANSPARENT
),
245 mnViewLayoutColumns( 0 ),
246 m_nPagePreviewRow( 1 ),
247 m_nPagePreviewCol( 2 ),
248 m_nShadowCursorFillMode( SwFillMode::Tab
),
250 m_bStarOneSetting(false),
251 m_bIsPagePreview(false),
252 m_bSelectionInReadonly(false),
256 mbViewLayoutBookMode(false),
257 mbHideWhitespaceMode(false),
258 m_bShowPlaceHolderFields( true ),
260 m_eZoom( SvxZoomType::PERCENT
),
261 m_nTableDestination(TBL_DEST_CELL
)
264 ViewOptCoreFlags2::BlackFont
|
265 ViewOptCoreFlags2::HiddenPara
;
268 ViewOptFlags2::Modified
|
269 ViewOptFlags2::GrfKeepZoom
|
270 ViewOptFlags2::ResolvedPostits
|
271 ViewOptFlags2::AnyRuler
;
273 if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric
!= SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
275 m_aSnapSize
.setWidth(720); // 1/2"
276 m_aSnapSize
.setHeight(720); // 1/2"
281 m_aSnapSize
.setWidth(567); // 1 cm
282 m_aSnapSize
.setHeight(567); // 1 cm
284 m_nDivisionX
= m_nDivisionY
= 1;
286 m_bSelectionInReadonly
= utl::ConfigManager::IsFuzzing() || SvtAccessibilityOptions::IsSelectionInReadonly();
290 m_nDefaultAnchor
= 1; //FLY_TO_CHAR
293 // correspond to the statements in ui/config/cfgvw.src
294 m_bTest1
= m_bTest2
= m_bTest3
= m_bTest4
=
295 m_bTest5
= m_bTest6
= m_bTest7
= m_bTest8
= m_bTest10
= false;
297 m_aColorConfig
= s_aInitialColorConfig
;
298 if (comphelper::LibreOfficeKit::isActive())
299 m_aColorConfig
.m_aAppBackgroundColor
= COL_TRANSPARENT
;
302 SwViewOption::SwViewOption(const SwViewOption
& rVOpt
)
305 m_bSelectionInReadonly
= false;
306 // #114856# Form view
307 m_sThemeName
= rVOpt
.m_sThemeName
;
308 mbFormView
= rVOpt
.mbFormView
;
309 m_nZoom
= rVOpt
.m_nZoom
;
310 m_aSnapSize
= rVOpt
.m_aSnapSize
;
311 mnViewLayoutColumns
= rVOpt
.mnViewLayoutColumns
;
312 m_nDivisionX
= rVOpt
.m_nDivisionX
;
313 m_nDivisionY
= rVOpt
.m_nDivisionY
;
314 m_nPagePreviewRow
= rVOpt
.m_nPagePreviewRow
;
315 m_nPagePreviewCol
= rVOpt
.m_nPagePreviewCol
;
316 m_bIsPagePreview
= rVOpt
.m_bIsPagePreview
;
317 m_eZoom
= rVOpt
.m_eZoom
;
318 m_nTableDestination
= rVOpt
.m_nTableDestination
;
319 m_nUIOptions
= rVOpt
.m_nUIOptions
;
320 m_nCoreOptions
= rVOpt
.m_nCoreOptions
;
321 m_nCore2Options
= rVOpt
.m_nCore2Options
;
322 m_aRetouchColor
= rVOpt
.GetRetoucheColor();
323 m_sSymbolFont
= rVOpt
.m_sSymbolFont
;
324 m_nShadowCursorFillMode
= rVOpt
.m_nShadowCursorFillMode
;
325 m_bStarOneSetting
= rVOpt
.m_bStarOneSetting
;
326 mbBookView
= rVOpt
.mbBookView
;
327 mbBrowseMode
= rVOpt
.mbBrowseMode
;
328 mbViewLayoutBookMode
= rVOpt
.mbViewLayoutBookMode
;
329 mbHideWhitespaceMode
= rVOpt
.mbHideWhitespaceMode
;
330 m_bShowPlaceHolderFields
= rVOpt
.m_bShowPlaceHolderFields
;
331 m_bIdle
= rVOpt
.m_bIdle
;
332 m_nDefaultAnchor
= rVOpt
.m_nDefaultAnchor
;
333 m_aColorConfig
= rVOpt
.m_aColorConfig
;
336 m_bTest1
= rVOpt
.m_bTest1
;
337 m_bTest2
= rVOpt
.m_bTest2
;
338 m_bTest3
= rVOpt
.m_bTest3
;
339 m_bTest4
= rVOpt
.m_bTest4
;
340 m_bTest5
= rVOpt
.m_bTest5
;
341 m_bTest6
= rVOpt
.m_bTest6
;
342 m_bTest7
= rVOpt
.m_bTest7
;
343 m_bTest8
= rVOpt
.m_bTest8
;
344 m_bTest10
= rVOpt
.m_bTest10
;
348 SwViewOption
& SwViewOption::operator=( const SwViewOption
&rVOpt
)
350 // #114856# Form view
351 m_sThemeName
= rVOpt
.m_sThemeName
;
352 mbFormView
= rVOpt
.mbFormView
;
353 m_nZoom
= rVOpt
.m_nZoom
;
354 m_aSnapSize
= rVOpt
.m_aSnapSize
;
355 mnViewLayoutColumns
= rVOpt
.mnViewLayoutColumns
;
356 m_nDivisionX
= rVOpt
.m_nDivisionX
;
357 m_nDivisionY
= rVOpt
.m_nDivisionY
;
358 m_nPagePreviewRow
= rVOpt
.m_nPagePreviewRow
;
359 m_nPagePreviewCol
= rVOpt
.m_nPagePreviewCol
;
360 m_bIsPagePreview
= rVOpt
.m_bIsPagePreview
;
361 m_eZoom
= rVOpt
.m_eZoom
;
362 m_nTableDestination
= rVOpt
.m_nTableDestination
;
363 m_nUIOptions
= rVOpt
.m_nUIOptions
;
364 m_nCoreOptions
= rVOpt
.m_nCoreOptions
;
365 m_nCore2Options
= rVOpt
.m_nCore2Options
;
366 m_aRetouchColor
= rVOpt
.GetRetoucheColor();
367 m_sSymbolFont
= rVOpt
.m_sSymbolFont
;
368 m_nShadowCursorFillMode
= rVOpt
.m_nShadowCursorFillMode
;
369 m_bStarOneSetting
= rVOpt
.m_bStarOneSetting
;
370 mbBookView
= rVOpt
.mbBookView
;
371 mbBrowseMode
= rVOpt
.mbBrowseMode
;
372 mbViewLayoutBookMode
= rVOpt
.mbViewLayoutBookMode
;
373 mbHideWhitespaceMode
= rVOpt
.mbHideWhitespaceMode
;
374 m_bShowPlaceHolderFields
= rVOpt
.m_bShowPlaceHolderFields
;
375 m_bIdle
= rVOpt
.m_bIdle
;
376 m_nDefaultAnchor
= rVOpt
.m_nDefaultAnchor
;
377 m_aColorConfig
= rVOpt
.m_aColorConfig
;
380 m_bTest1
= rVOpt
.m_bTest1
;
381 m_bTest2
= rVOpt
.m_bTest2
;
382 m_bTest3
= rVOpt
.m_bTest3
;
383 m_bTest4
= rVOpt
.m_bTest4
;
384 m_bTest5
= rVOpt
.m_bTest5
;
385 m_bTest6
= rVOpt
.m_bTest6
;
386 m_bTest7
= rVOpt
.m_bTest7
;
387 m_bTest8
= rVOpt
.m_bTest8
;
388 m_bTest10
= rVOpt
.m_bTest10
;
393 SwViewOption::~SwViewOption()
397 void SwViewOption::Init(const OutputDevice
* pWin
)
399 if( !s_nPixelTwips
&& pWin
)
401 s_nPixelTwips
= o3tl::narrowing
<sal_uInt16
>(pWin
->PixelToLogic( Size(1,1) ).Height());
405 bool SwViewOption::IsAutoCompleteWords()
407 const SvxSwAutoFormatFlags
& rFlags
= SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags();
408 return rFlags
.bAutoCmpltCollectWords
;
411 AuthorCharAttr::AuthorCharAttr() :
412 m_nItemId (SID_ATTR_CHAR_UNDERLINE
),
413 m_nAttr (LINESTYLE_SINGLE
),
414 m_nColor (COL_TRANSPARENT
)
418 sal_uInt16
GetHtmlMode(const SwDocShell
* pShell
)
421 if(!pShell
|| dynamic_cast<const SwWebDocShell
*>( pShell
) )
423 nRet
= HTMLMODE_ON
| HTMLMODE_SOME_STYLES
;
424 switch ( SvxHtmlOptions::GetExportMode() )
427 nRet
|= HTMLMODE_FULL_STYLES
;
430 // no special features for this browser
432 case HTML_CFG_WRITER
:
433 nRet
|= HTMLMODE_FULL_STYLES
;
440 RndStdIds
SwViewOption::GetDefaultAnchorType() const
442 switch ( m_nDefaultAnchor
)
445 return RndStdIds::FLY_AT_PARA
; //0
447 return RndStdIds::FLY_AT_CHAR
; //4
449 return RndStdIds::FLY_AS_CHAR
; //1
451 return RndStdIds::FLY_AT_CHAR
; //4
455 const Color
& SwViewOption::GetDocColor() const
457 return m_aColorConfig
.m_aDocColor
;
460 const Color
& SwViewOption::GetDocBoundariesColor() const
462 return m_aColorConfig
.m_aDocBoundColor
;
465 const Color
& SwViewOption::GetObjectBoundariesColor() const
467 return m_aColorConfig
.m_aObjectBoundColor
;
470 const Color
& SwViewOption::GetAppBackgroundColor() const
472 return m_aColorConfig
.m_aAppBackgroundColor
;
475 const Color
& SwViewOption::GetTableBoundariesColor() const
477 return m_aColorConfig
.m_aTableBoundColor
;
480 const Color
& SwViewOption::GetIndexShadingsColor() const
482 return m_aColorConfig
.m_aIndexShadingsColor
;
485 const Color
& SwViewOption::GetLinksColor() const
487 return m_aColorConfig
.m_aLinksColor
;
490 const Color
& SwViewOption::GetVisitedLinksColor() const
492 return m_aColorConfig
.m_aVisitedLinksColor
;
495 const Color
& SwViewOption::GetDirectCursorColor() const
497 return m_aColorConfig
.m_aDirectCursorColor
;
500 const Color
& SwViewOption::GetTextGridColor() const
502 return m_aColorConfig
.m_aTextGridColor
;
505 const Color
& SwViewOption::GetSpellColor() const
507 return m_aColorConfig
.m_aSpellColor
;
510 const Color
& SwViewOption::GetGrammarColor() const
512 return m_aColorConfig
.m_aGrammarColor
;
515 const Color
& SwViewOption::GetSmarttagColor() const
517 return m_aColorConfig
.m_aSmarttagColor
;
520 const Color
& SwViewOption::GetShadowColor() const
522 return m_aColorConfig
.m_aShadowColor
;
525 const Color
& SwViewOption::GetFontColor() const
527 return m_aColorConfig
.m_aFontColor
;
530 const Color
& SwViewOption::GetFieldShadingsColor() const
532 return m_aColorConfig
.m_aFieldShadingsColor
;
535 const Color
& SwViewOption::GetSectionBoundColor() const
537 return m_aColorConfig
.m_aSectionBoundColor
;
540 const Color
& SwViewOption::GetPageBreakColor() const
542 return m_aColorConfig
.m_aPageBreakColor
;
545 const Color
& SwViewOption::GetHeaderFooterMarkColor() const
547 return m_aColorConfig
.m_aHeaderFooterMarkColor
;
550 void SwViewOption::SetAppearanceFlag(ViewOptFlags nFlag
, bool bSet
, bool bSaveInConfig
)
553 m_aColorConfig
.m_nAppearanceFlags
|= nFlag
;
555 m_aColorConfig
.m_nAppearanceFlags
&= ~nFlag
;
559 //create an editable svtools::ColorConfig and store the change
560 svtools::EditableColorConfig aEditableConfig
;
561 struct FlagToConfig_Impl
564 svtools::ColorConfigEntry eEntry
;
566 static const FlagToConfig_Impl aFlags
[] =
568 { ViewOptFlags::DocBoundaries
, svtools::DOCBOUNDARIES
},
569 { ViewOptFlags::ObjectBoundaries
, svtools::OBJECTBOUNDARIES
},
570 { ViewOptFlags::TableBoundaries
, svtools::TABLEBOUNDARIES
},
571 { ViewOptFlags::IndexShadings
, svtools::WRITERIDXSHADINGS
},
572 { ViewOptFlags::Links
, svtools::LINKS
},
573 { ViewOptFlags::VisitedLinks
, svtools::LINKSVISITED
},
574 { ViewOptFlags::FieldShadings
, svtools::WRITERFIELDSHADINGS
},
575 { ViewOptFlags::SectionBoundaries
, svtools::WRITERSECTIONBOUNDARIES
},
576 { ViewOptFlags::Shadow
, svtools::SHADOWCOLOR
},
577 { ViewOptFlags::NONE
, svtools::ColorConfigEntryCount
}
580 while(aFlags
[nPos
].nFlag
!= ViewOptFlags::NONE
)
582 if(nFlag
& aFlags
[nPos
].nFlag
)
584 svtools::ColorConfigValue aValue
= aEditableConfig
.GetColorValue(aFlags
[nPos
].eEntry
);
585 aValue
.bIsVisible
= bSet
;
586 aEditableConfig
.SetColorValue(aFlags
[nPos
].eEntry
, aValue
);
592 bool SwViewOption::IsAppearanceFlag(ViewOptFlags nFlag
) const
594 return bool(m_aColorConfig
.m_nAppearanceFlags
& nFlag
);
598 rtl::Reference
<comphelper::ConfigurationListener
> const & getWCOptionListener()
600 static rtl::Reference
<comphelper::ConfigurationListener
> xListener(new comphelper::ConfigurationListener("/org.openoffice.Office.Writer/Cursor/Option"));
605 bool SwViewOption::IsIgnoreProtectedArea()
607 if (utl::ConfigManager::IsFuzzing())
609 static comphelper::ConfigurationListenerProperty
<bool> gIgnoreProtectedArea(getWCOptionListener(), "IgnoreProtectedArea");
610 return gIgnoreProtectedArea
.get();
613 const SwViewOption
& SwViewOption::GetCurrentViewOptions()
615 SfxViewShell
* pCurrentShell
= SfxViewShell::Current();
616 SwView
* pView
= dynamic_cast<SwView
*>(pCurrentShell
);
619 return *pView
->GetWrtShell().GetViewOptions();
622 // Some unit tests don't have a SfxViewShell, so we need to return something
623 static SwViewOption aDefaultViewOptions
;
624 return aDefaultViewOptions
;
627 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */