De-static-izing colors in SwViewOption

The view colors in SwViewOption were static which means that two
separate views couldn't have different colors

Change-Id: Id595b00ba56bdb210ad1a784cf76e99ead0d6014
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148481
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index c399aa6..4c9dcf8 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -193,30 +193,62 @@ namespace o3tl {
    template<> struct typed_flags<ViewOptFlags> : is_typed_flags<ViewOptFlags, 0x01ff> {};
}

struct SwViewColors
{
    SwViewColors();
    SwViewColors(const svtools::ColorConfig& rConfig);
    bool operator==(const SwViewColors& rOther) const
    {
        return m_aDocColor == rOther.m_aDocColor
            && m_aDocBoundColor == rOther.m_aDocBoundColor
            && m_aObjectBoundColor == rOther.m_aObjectBoundColor
            && m_aAppBackgroundColor == rOther.m_aAppBackgroundColor
            && m_aTableBoundColor == rOther.m_aTableBoundColor
            && m_aFontColor == rOther.m_aFontColor
            && m_aIndexShadingsColor == rOther.m_aIndexShadingsColor
            && m_aLinksColor == rOther.m_aLinksColor
            && m_aVisitedLinksColor == rOther.m_aVisitedLinksColor
            && m_aDirectCursorColor == rOther.m_aDirectCursorColor
            && m_aTextGridColor == rOther.m_aTextGridColor
            && m_aSpellColor == rOther.m_aSpellColor
            && m_aGrammarColor == rOther.m_aGrammarColor
            && m_aSmarttagColor == rOther.m_aSmarttagColor
            && m_aFieldShadingsColor == rOther.m_aFieldShadingsColor
            && m_aSectionBoundColor == rOther.m_aSectionBoundColor
            && m_aPageBreakColor == rOther.m_aPageBreakColor
            && m_aScriptIndicatorColor == rOther.m_aScriptIndicatorColor
            && m_aShadowColor == rOther.m_aShadowColor
            && m_aHeaderFooterMarkColor == rOther.m_aHeaderFooterMarkColor
            && m_nAppearanceFlags == rOther.m_nAppearanceFlags;
    }
    Color m_aDocColor;  // color of document boundaries
    Color m_aDocBoundColor;  // color of document boundaries
    Color m_aObjectBoundColor; // color of object boundaries
    Color m_aAppBackgroundColor; // application background
    Color m_aTableBoundColor; // color of table boundaries
    Color m_aFontColor;
    Color m_aIndexShadingsColor; // background color of indexes
    Color m_aLinksColor;
    Color m_aVisitedLinksColor;
    Color m_aDirectCursorColor;
    Color m_aTextGridColor;
    Color m_aSpellColor;     // mark color of online spell checking
    Color m_aGrammarColor;
    Color m_aSmarttagColor;
    Color m_aFieldShadingsColor;
    Color m_aSectionBoundColor;
    Color m_aPageBreakColor;
    Color m_aScriptIndicatorColor;
    Color m_aShadowColor;
    Color m_aHeaderFooterMarkColor;
    ViewOptFlags m_nAppearanceFlags;
};

class SW_DLLPUBLIC SwViewOption
{
    static Color    s_aDocColor;  // color of document boundaries
    static Color    s_aDocBoundColor;  // color of document boundaries
    static Color    s_aObjectBoundColor; // color of object boundaries
    static Color    s_aAppBackgroundColor; // application background
    static Color    s_aTableBoundColor; // color of table boundaries
    static Color    s_aFontColor;
    static Color    s_aIndexShadingsColor; // background color of indexes
    static Color    s_aLinksColor;
    static Color    s_aVisitedLinksColor;
    static Color    s_aDirectCursorColor;
    static Color    s_aTextGridColor;
    static Color    s_aSpellColor;     // mark color of online spell checking
    static Color    s_aGrammarColor;
    static Color    s_aSmarttagColor;
    static Color    s_aFieldShadingsColor;
    static Color    s_aSectionBoundColor;
    static Color    s_aPageBreakColor;
    static Color    s_aScriptIndicatorColor;
    static Color    s_aShadowColor;
    static Color    s_aHeaderFooterMarkColor;
    SwViewColors m_aColorConfig;
    static SwViewColors s_aInitialColorConfig;

    static ViewOptFlags s_nAppearanceFlags;
    static sal_uInt16   s_nPixelTwips;// 1 Pixel == ? Twips

    OUString        m_sSymbolFont;        // Symbolfont.
@@ -272,6 +304,21 @@ public:

    inline void     SetUIOptions( const SwViewOption& );

    void SetColorConfig(const SwViewColors& rColorConfig)
    {
        m_aColorConfig = rColorConfig;
    }

    const SwViewColors& GetColorConfig() const
    {
        return m_aColorConfig;
    }

    static void SetInitialColorConfig(const SwViewColors& rColorConfig)
    {
        s_aInitialColorConfig = rColorConfig;
    }

    // Options from nCoreOptions
    bool IsIdle() const
        { return m_bIdle; }
@@ -382,8 +429,8 @@ public:
    void SetResolvedPostIts( bool b )
    { SetUIOption(b, ViewOptFlags2::ResolvedPostits); }

    static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
                              bool bIsScript );
    void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
                              bool bIsScript ) const;
    static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut );

    //show/hide tooltips on tracked changes
@@ -749,43 +796,41 @@ public:
    bool        IsShowPlaceHolderFields() const { return m_bShowPlaceHolderFields; }
    void            SetShowPlaceHolderFields(bool bSet) { m_bShowPlaceHolderFields = bSet; }

    static Color&   GetDocColor();
    static Color&   GetDocBoundariesColor();
    static Color&   GetAppBackgroundColor();
    static Color&   GetObjectBoundariesColor();
    static Color&   GetTableBoundariesColor();
    static Color&   GetIndexShadingsColor();
    static Color&   GetLinksColor();
    static Color&   GetVisitedLinksColor();
    static Color&   GetDirectCursorColor();
    static Color&   GetTextGridColor();
    static Color&   GetSpellColor();
    static Color&   GetGrammarColor();
    static Color&   GetSmarttagColor();
    static Color&   GetShadowColor();
    static Color&   GetFontColor();
    static Color&   GetFieldShadingsColor();
    static Color&   GetSectionBoundColor();
    static Color&   GetPageBreakColor();
    static Color&   GetHeaderFooterMarkColor();
    const Color& GetDocColor() const;
    const Color& GetDocBoundariesColor() const;
    const Color& GetAppBackgroundColor() const;
    const Color& GetObjectBoundariesColor() const;
    const Color& GetTableBoundariesColor() const;
    const Color& GetIndexShadingsColor() const;
    const Color& GetLinksColor() const;
    const Color& GetVisitedLinksColor() const;
    const Color& GetDirectCursorColor() const;
    const Color& GetTextGridColor() const;
    const Color& GetSpellColor() const;
    const Color& GetGrammarColor() const;
    const Color& GetSmarttagColor() const;
    const Color& GetShadowColor() const;
    const Color& GetFontColor() const;
    const Color& GetFieldShadingsColor() const;
    const Color& GetSectionBoundColor() const;
    const Color& GetPageBreakColor() const;
    const Color& GetHeaderFooterMarkColor() const;

    static bool     IsAppearanceFlag(ViewOptFlags nFlag);
    bool IsAppearanceFlag(ViewOptFlags nFlag) const;

    static bool     IsDocBoundaries()     {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);}
    static bool     IsObjectBoundaries()  {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);}
    static bool     IsTableBoundaries()   {return IsAppearanceFlag(ViewOptFlags::TableBoundaries );}
    static bool     IsIndexShadings()     {return IsAppearanceFlag(ViewOptFlags::IndexShadings   );}
    static bool     IsLinks()             {return IsAppearanceFlag(ViewOptFlags::Links            );}
    static bool     IsVisitedLinks()      {return IsAppearanceFlag(ViewOptFlags::VisitedLinks    );}
    static bool     IsFieldShadings()     {return IsAppearanceFlag(ViewOptFlags::FieldShadings);}
    static bool     IsSectionBoundaries() {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);}
    static bool     IsShadow()            {return IsAppearanceFlag(ViewOptFlags::Shadow           );}
    bool IsDocBoundaries() const {return IsAppearanceFlag(ViewOptFlags::DocBoundaries);}
    bool IsObjectBoundaries() const {return IsAppearanceFlag(ViewOptFlags::ObjectBoundaries);}
    bool IsTableBoundaries() const {return IsAppearanceFlag(ViewOptFlags::TableBoundaries);}
    bool IsIndexShadings() const {return IsAppearanceFlag(ViewOptFlags::IndexShadings);}
    bool IsLinks() const {return IsAppearanceFlag(ViewOptFlags::Links);}
    bool IsVisitedLinks() const {return IsAppearanceFlag(ViewOptFlags::VisitedLinks);}
    bool IsFieldShadings() const {return IsAppearanceFlag(ViewOptFlags::FieldShadings);}
    bool IsSectionBoundaries() const {return IsAppearanceFlag(ViewOptFlags::SectionBoundaries);}
    bool IsShadow() const {return IsAppearanceFlag(ViewOptFlags::Shadow);}

    static void     SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false);
    void     SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig = false);

    static void     SetDocBoundaries(bool bSet)   {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);}

    static void     ApplyColorConfigValues(const svtools::ColorConfig& rConfig);
    void     SetDocBoundaries(bool bSet)   {SetAppearanceFlag(ViewOptFlags::DocBoundaries, bSet);}

    // get/set default anchor (0..2); use GetDefaultAnchorType() to convert into RndStdIds::FLY_*
    sal_Int32 GetDefaultAnchor() const
@@ -794,11 +839,14 @@ public:
        { m_nDefaultAnchor = aFlag; }

    RndStdIds GetDefaultAnchorType() const;

    // Useful for when getting the current view SwViewOption is not possible otherwise
    static const SwViewOption& GetCurrentViewOptions();
};

inline bool SwViewOption::operator==( const SwViewOption &rOpt ) const
{
    return IsEqualFlags( rOpt ) && m_nZoom == rOpt.GetZoom();
    return IsEqualFlags( rOpt ) && m_nZoom == rOpt.GetZoom() && m_aColorConfig == rOpt.m_aColorConfig;
}

inline void SwViewOption::SetUIOptions( const SwViewOption& rVOpt )
diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx
index 684953c..637c379 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -392,7 +392,7 @@ bool SwAccessibleFrame::IsOpaque( SwViewShell const *pVSh ) const
            if( pSection && ( SectionType::ToxHeader == pSection->GetType() ||
                SectionType::ToxContent == pSection->GetType() ) &&
                !pVOpt->IsReadonly() &&
                SwViewOption::IsIndexShadings() )
                pVOpt->IsIndexShadings() )
                return true;
        }
        if( pFrame->IsFlyFrame() )
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 70eec47..078b647 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1918,7 +1918,7 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
        if (rValue.Name == UNO_NAME_CHAR_COLOR)
        {
            if( GetPortionData().IsInGrayPortion( nIndex ) )
                 rValue.Value <<= SwViewOption::GetFieldShadingsColor();
                rValue.Value <<= GetCursorShell()->GetViewOptions()->GetFieldShadingsColor();
            uno::Any &anyChar = rValue.Value;
            sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));

diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 6cc693c..152d4f9 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -259,7 +259,7 @@ bool SwAccessiblePortionData::IsGrayPortionType( PortionType nType ) const
        case PortionType::Tox:
        case PortionType::Hidden:
            bGray = !m_pViewOptions->IsPagePreview() &&
                !m_pViewOptions->IsReadonly() && SwViewOption::IsFieldShadings();
                !m_pViewOptions->IsReadonly() && m_pViewOptions->IsFieldShadings();
            break;
        case PortionType::Tab:       bGray = m_pViewOptions->IsTab();          break;
        case PortionType::SoftHyphen:  bGray = m_pViewOptions->IsSoftHyph();     break;
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index b93c6a9..d4bef9d 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -109,7 +109,7 @@ private:
        {
        }

        return SwViewOption::GetGrammarColor();
        return SwViewOption::GetCurrentViewOptions().GetGrammarColor();
    }

    static WrongAreaLineType getGrammarLineType( css::uno::Reference< css::container::XStringKeyMap > const & xPropertyBag )
@@ -175,7 +175,7 @@ private:
        {
        }

        return SwViewOption::GetSmarttagColor( );
        return SwViewOption::GetCurrentViewOptions().GetSmarttagColor();
    }

    static WrongAreaLineType getSmartLineType( css::uno::Reference< css::container::XStringKeyMap > const & xPropertyBag )
@@ -224,7 +224,7 @@ private:
    {
        if (WRONGLIST_SPELL == listType)
        {
            return SwViewOption::GetSpellColor();
            return SwViewOption::GetCurrentViewOptions().GetSpellColor();
        }
        else if (WRONGLIST_GRAMMAR == listType)
        {
@@ -235,7 +235,7 @@ private:
            return  getSmartColor(xPropertyBag);
        }

        return SwViewOption::GetSpellColor();
        return SwViewOption::GetCurrentViewOptions().GetSpellColor();
    }

    static WrongAreaLineType getWrongAreaLineType(WrongListType listType,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ad609ae..37a5341 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -330,7 +330,7 @@ static bool isSubsidiaryLinesFlysEnabled()
    return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
           SwViewOption::IsObjectBoundaries();
           gProp.pSGlobalShell->GetViewOptions()->IsObjectBoundaries();
}
//other subsidiary lines enabled?
static bool isSubsidiaryLinesEnabled()
@@ -339,7 +339,7 @@ static bool isSubsidiaryLinesEnabled()
           !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsWhitespaceHidden() &&
           SwViewOption::IsDocBoundaries();
           gProp.pSGlobalShell->GetViewOptions()->IsDocBoundaries();
}
//subsidiary lines for sections
static bool isSubsidiaryLinesForSectionsEnabled()
@@ -347,7 +347,7 @@ static bool isSubsidiaryLinesForSectionsEnabled()
    return !gProp.pSGlobalShell->GetViewOptions()->IsPagePreview() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsReadonly() &&
           !gProp.pSGlobalShell->GetViewOptions()->IsFormView() &&
           SwViewOption::IsSectionBoundaries();
           gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries();
}


@@ -367,7 +367,7 @@ bool isTableBoundariesEnabled()
    if (gProp.pSGlobalShell->GetViewOptions()->IsFormView())
        return false;

    return SwViewOption::IsTableBoundaries();
    return gProp.pSGlobalShell->GetViewOptions()->IsTableBoundaries();
}

}
@@ -1093,12 +1093,14 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
             !rLRect.IsLocked() )
        {
            const Color *pCol = nullptr;
            SwViewShell *pShell = properties.pSGlobalShell;
            const SwViewOption *pOpt = pShell->GetViewOptions();
            switch ( rLRect.GetSubColor() )
            {
                case SubColFlags::Page: pCol = &SwViewOption::GetDocBoundariesColor(); break;
                case SubColFlags::Fly: pCol = &SwViewOption::GetObjectBoundariesColor(); break;
                case SubColFlags::Tab: pCol = &SwViewOption::GetTableBoundariesColor(); break;
                case SubColFlags::Sect: pCol = &SwViewOption::GetSectionBoundColor(); break;
                case SubColFlags::Page: pCol = &pOpt->GetDocBoundariesColor(); break;
                case SubColFlags::Fly: pCol = &pOpt->GetObjectBoundariesColor(); break;
                case SubColFlags::Tab: pCol = &pOpt->GetTableBoundariesColor(); break;
                case SubColFlags::Sect: pCol = &pOpt->GetSectionBoundColor(); break;
            }

            if (pCol && pOut->GetFillColor() != *pCol)
@@ -2448,7 +2450,7 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
    bool bHori = true;

    // color for subsidiary lines:
    const Color& rCol( SwViewOption::GetTableBoundariesColor() );
    const Color& rCol( gProp.pSGlobalShell->GetViewOptions()->GetTableBoundariesColor() );

    // high contrast mode:
    // overrides the color of non-subsidiary lines.
@@ -2457,7 +2459,7 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
    if( gProp.pSGlobalShell->GetWin() &&
        Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
    {
        pHCColor = &SwViewOption::GetFontColor();
        pHCColor = &gProp.pSGlobalShell->GetViewOptions()->GetFontColor();
        rDev.SetDrawMode( DrawModeFlags::Default );
    }

@@ -3339,7 +3341,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
                {
                    SdrPaintView* pPaintView = pSh->Imp()->GetDrawView();
                    SdrPageView* pPageView = pPaintView->GetSdrPageView();
                    pPageView->DrawPageViewGrid(*pSh->GetOut(), aPaintRect.SVRect(), SwViewOption::GetTextGridColor() );
                    pPageView->DrawPageViewGrid(*pSh->GetOut(), aPaintRect.SVRect(), pSh->GetViewOptions()->GetTextGridColor() );
                }

                // #i68597#
@@ -3750,7 +3752,7 @@ void SwColumnFrame::PaintBreak( ) const
        nWidth = aRect.Height();
    }

    basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor();
    basegfx::BColor aLineColor = gProp.pSGlobalShell->GetViewOptions()->GetPageBreakColor().getBColor();

    drawinglayer::primitive2d::Primitive2DContainer aSeq =
        lcl_CreateDashedIndicatorPrimitive( aStart, aEnd, aLineColor );
@@ -4568,7 +4570,7 @@ static void lcl_PaintShadow( const SwRect& rRect, SwRect& rOutRect,
        // to ignore the setting of a new color. Therefore we have to reset
        // the drawing mode
        pOut->SetDrawMode( DrawModeFlags::Default );
        aShadowColor = SwViewOption::GetFontColor();
        aShadowColor = properties.pSGlobalShell->GetViewOptions()->GetFontColor();
    }

    if ( pOut->GetFillColor() != aShadowColor )
@@ -4656,7 +4658,9 @@ void SwFrame::PaintBorderLine( const SwRect& rRect,
    if( pColor && gProp.pSGlobalShell->GetWin() &&
        Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
    {
        pColor = &SwViewOption::GetFontColor();
        SwViewShell *pSh = getRootFrame()->GetCurrShell();
        const SwViewOption *pOpt = pSh->GetViewOptions();
        pColor = &pOpt->GetFontColor();
    }

    if (pPage->GetSortedObjs() &&
@@ -5977,7 +5981,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
            }
        }

        pOut->SetFillColor(SwViewOption::GetAppBackgroundColor());
        pOut->SetFillColor(SwViewOption::GetCurrentViewOptions().GetAppBackgroundColor());
        pOut->SetLineColor();
        pOut->DrawRect(pOut->PixelToLogic(aRect));
    }
@@ -6015,7 +6019,7 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
                                                 bool bRightSidebar )
{
    // No shadow in prefs
    if (!SwViewOption::IsShadow())
    if (!_pViewShell->GetViewOptions()->IsShadow())
        return;

    // #i16816# tagged pdf support
@@ -6048,9 +6052,9 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
    ::SwAlignRect( aAlignedPageRect, _pViewShell, _pViewShell->GetOut() );
    SwRect aPagePxRect(_pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ));

    if (aShadowColor != SwViewOption::GetShadowColor())
    if (aShadowColor != _pViewShell->GetViewOptions()->GetShadowColor())
    {
        aShadowColor = SwViewOption::GetShadowColor();
        aShadowColor = _pViewShell->GetViewOptions()->GetShadowColor();

        AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
        Bitmap aFilledSquare(aMask.GetSizePixel(), vcl::PixelFormat::N24_BPP);
@@ -6185,23 +6189,23 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
    _pViewShell->GetOut()->SetLineColor();
    if (!bRight)
    {
        _pViewShell->GetOut()->SetFillColor(SwViewOption::GetObjectBoundariesColor());
        _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetObjectBoundariesColor());
        _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height())))    ;
        if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
            _pViewShell->GetOut()->SetFillColor(COL_BLACK);
        else
            _pViewShell->GetOut()->SetFillColor(SwViewOption::GetSectionBoundColor());
            _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetSectionBoundColor());
        _pViewShell->GetOut()->DrawRect(tools::Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarWidth()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height())))  ;
    }
    else
    {
        _pViewShell->GetOut()->SetFillColor(SwViewOption::GetObjectBoundariesColor());
        _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetObjectBoundariesColor());
        SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()));
        _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect());
        if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
            _pViewShell->GetOut()->SetFillColor(COL_BLACK);
        else
            _pViewShell->GetOut()->SetFillColor(SwViewOption::GetSectionBoundColor());
            _pViewShell->GetOut()->SetFillColor(_pViewShell->GetViewOptions()->GetSectionBoundColor());
        SwRect aSidebar(Point(aPageRect.Right()+pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()));
        _pViewShell->GetOut()->DrawRect(aSidebar.SVRect());
    }
@@ -6400,8 +6404,9 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
                             const bool bOnlyTextBackground ) const
{
    // #i1837# - no paint of table background, if corresponding option is *not* set.
    SwViewShell *pSh = gProp.pSGlobalShell;
    if( IsTabFrame() &&
        !gProp.pSGlobalShell->GetViewOptions()->IsTable() )
        !pSh->GetViewOptions()->IsTable() )
    {
        return;
    }
@@ -6410,8 +6415,6 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP
    if( IsCellFrame() && IsCoveredCell() )
        return;

    SwViewShell *pSh = gProp.pSGlobalShell;

    // #i16816# tagged pdf support
    SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pSh->GetOut() );

@@ -6842,7 +6845,7 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreatePageAreaDelimit
{
    drawinglayer::primitive2d::Primitive2DContainer aSeq( 4 );

    basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
    basegfx::BColor aLineColor = SwViewOption::GetCurrentViewOptions().GetDocBoundariesColor().getBColor();
    double nLineLength = 200.0; // in Twips

    Point aPoints[] = { rRect.TopLeft(), rRect.TopRight(), rRect.BottomRight(), rRect.BottomLeft() };
@@ -6873,7 +6876,7 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateRectangleDelimi
        const SwRect& rRect )
{
    drawinglayer::primitive2d::Primitive2DContainer aSeq( 1 );
    basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
    basegfx::BColor aLineColor = SwViewOption::GetCurrentViewOptions().GetDocBoundariesColor().getBColor();

    basegfx::B2DPolygon aPolygon;
    aPolygon.append( basegfx::B2DPoint( rRect.Left(), rRect.Top() ) );
@@ -6893,7 +6896,7 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateColumnAreaDelim
{
    drawinglayer::primitive2d::Primitive2DContainer aSeq( 4 );

    basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
    basegfx::BColor aLineColor = SwViewOption::GetCurrentViewOptions().GetDocBoundariesColor().getBColor();
    double nLineLength = 100.0; // in Twips

    Point aPoints[] = { rRect.TopLeft(), rRect.TopRight(), rRect.BottomRight(), rRect.BottomLeft() };
@@ -6923,7 +6926,7 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateColumnAreaDelim
void SwPageFrame::PaintSubsidiaryLines( const SwPageFrame *,
                                        const SwRect & ) const
{
    if (!SwViewOption::IsDocBoundaries())
    if (!gProp.pSGlobalShell->GetViewOptions()->IsDocBoundaries())
        return;

    if ( gProp.pSGlobalShell->IsHeaderFooterEdit() )
@@ -6997,7 +7000,7 @@ void SwColumnFrame::PaintSubsidiaryLines( const SwPageFrame *,
void SwSectionFrame::PaintSubsidiaryLines( const SwPageFrame * pPage,
                                        const SwRect & rRect ) const
{
    if (!SwViewOption::IsSectionBoundaries())
    if (!gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries())
        return;

    const bool bNoLowerColumn = !Lower() || !Lower()->IsColumnFrame();
@@ -7018,7 +7021,7 @@ void SwBodyFrame::PaintSubsidiaryLines( const SwPageFrame *,

void SwHeadFootFrame::PaintSubsidiaryLines( const SwPageFrame *, const SwRect & ) const
{
    if (!SwViewOption::IsDocBoundaries())
    if (!gProp.pSGlobalShell->GetViewOptions()->IsDocBoundaries())
        return;

    if ( gProp.pSGlobalShell->IsHeaderFooterEdit() )
@@ -7490,11 +7493,11 @@ bool SwFrame::GetBackgroundBrush(
                !pOpt->IsReadonly() &&
                // #114856# Form view
                !pOpt->IsFormView() &&
                SwViewOption::IsIndexShadings() &&
                pOpt->IsIndexShadings() &&
                !pOpt->IsPDFExport() &&
                pSh->GetOut()->GetOutDevType() != OUTDEV_PRINTER )
            {
                rxCol = SwViewOption::GetIndexShadingsColor();
                rxCol = pOpt->GetIndexShadingsColor();
            }
        }

diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 7fab6da..0488782 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -237,8 +237,8 @@ static bool lcl_ChgHyperLinkColor( const SwTextAttr& rAttr,

    if ( pShell->GetWin() &&
        (
          (rINetAttr.IsVisited() && SwViewOption::IsVisitedLinks()) ||
          (!rINetAttr.IsVisited() && SwViewOption::IsLinks())
          (rINetAttr.IsVisited() && pShell->GetViewOptions()->IsVisitedLinks()) ||
          (!rINetAttr.IsVisited() && pShell->GetViewOptions()->IsLinks())
        )
       )
    {
@@ -247,12 +247,12 @@ static bool lcl_ChgHyperLinkColor( const SwTextAttr& rAttr,
            if (rINetAttr.IsVisited())
            {
                // take color from view option 'visited link color'
                *pColor = SwViewOption::GetVisitedLinksColor();
                *pColor = pShell->GetViewOptions()->GetVisitedLinksColor();
            }
            else
            {
                // take color from view option 'unvisited link color'
                *pColor = SwViewOption::GetLinksColor();
                *pColor = pShell->GetViewOptions()->GetLinksColor();
            }
        }
        return true;
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index a4fea74..358b961 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1084,7 +1084,7 @@ void SwTextPaintInfo::DrawPostIts( bool bScript ) const
    if ( GetTextFrame()->IsVertical() )
        GetTextFrame()->SwitchHorizontalToVertical( aTmpRect );

    SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
    GetOpt().PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );

}

@@ -1095,12 +1095,12 @@ void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool 
    if ( !aIntersect.HasArea() )
        return;

    if (OnWin() && SwViewOption::IsFieldShadings() &&
    if (OnWin() && GetOpt().IsFieldShadings() &&
            !GetOpt().IsPagePreview())
    {
        OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
        pOut->Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR );
        pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
        pOut->SetFillColor( GetOpt().GetFieldShadingsColor() );
        pOut->SetLineColor();
        pOut->DrawRect( aIntersect.SVRect() );
        pOut->Pop();
@@ -1135,7 +1135,7 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pC
    if ( pColor )
        pOut->SetFillColor( *pColor );
    else
        pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
        pOut->SetFillColor( GetOpt().GetFieldShadingsColor() );

    pOut->SetLineColor();

@@ -1161,12 +1161,12 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
            if(bIsStartMark)
                SAL_INFO("sw.core", "Found StartMark");
            if (OnWin() && (pFieldmark!=nullptr || bIsStartMark) &&
                    SwViewOption::IsFieldShadings() &&
                    GetOpt().IsFieldShadings() &&
                    !GetOpt().IsPagePreview())
            {
                OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
                pOutDev->Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR );
                pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
                pOutDev->SetFillColor( GetOpt().GetFieldShadingsColor() );
                pOutDev->SetLineColor( );
                pOutDev->DrawRect( aIntersect.SVRect() );
                pOutDev->Pop();
@@ -1326,7 +1326,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
    case PortionType::ControlChar:
        if ( !GetOpt().IsPagePreview()
             && !GetOpt().IsReadonly()
             && SwViewOption::IsFieldShadings()
             && GetOpt().IsFieldShadings()
             && ( PortionType::Number != nWhich
                  || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
        {
@@ -1339,7 +1339,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
    case PortionType::InputField:
        // input field shading also in read-only mode
        if ( !GetOpt().IsPagePreview()
             && SwViewOption::IsFieldShadings() )
             && GetOpt().IsFieldShadings() )
        {
            bDraw = true;
        }
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index e0737d4..04612aa 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -121,7 +121,7 @@ sal_uInt16 SwFieldPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
    // even though this is const, nViewWidth should be computed at the very end:
    SwFieldPortion* pThis = const_cast<SwFieldPortion*>(this);
    if( !Width() && rInf.OnWin() && !rInf.GetOpt().IsPagePreview() &&
            !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() )
            !rInf.GetOpt().IsReadonly() && rInf.GetOpt().IsFieldShadings() )
    {
        if( !m_nViewWidth )
            pThis->m_nViewWidth = rInf.GetTextSize(OUString(' ')).Width();
@@ -459,7 +459,7 @@ bool SwFieldPortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) c
    rText = m_aExpand;
    if( rText.isEmpty() && rInf.OnWin() &&
        !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() &&
            SwViewOption::IsFieldShadings() &&
            rInf.GetOpt().IsFieldShadings() &&
            !HasFollow() )
        rText = " ";
    return true;
diff --git a/sw/source/core/text/porref.cxx b/sw/source/core/text/porref.cxx
index 502b681..a64f2df 100644
--- a/sw/source/core/text/porref.cxx
+++ b/sw/source/core/text/porref.cxx
@@ -45,7 +45,7 @@ sal_uInt16 SwIsoRefPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
    // Although we are const, nViewWidth should be calculated in the last
    // moment possible
    SwIsoRefPortion* pThis = const_cast<SwIsoRefPortion*>(this);
    if( !Width() && rInf.OnWin() && SwViewOption::IsFieldShadings() &&
    if( !Width() && rInf.OnWin() && rInf.GetOpt().IsFieldShadings() &&
            !rInf.GetOpt().IsReadonly() && !rInf.GetOpt().IsPagePreview() )
    {
        if( !m_nViewWidth )
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 73bd05a..5c04b60 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -604,7 +604,7 @@ void SwHiddenTextPortion::Paint( const SwTextPaintInfo & rInf) const
{
#ifdef DBG_UTIL
    OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
    Color aCol( SwViewOption::GetFieldShadingsColor() );
    Color aCol( rInf.GetOpt().GetFieldShadingsColor() );
    Color aOldColor( pOut->GetFillColor() );
    pOut->SetFillColor( aCol );
    Point aPos( rInf.GetPos() );
@@ -626,10 +626,10 @@ bool SwHiddenTextPortion::Format( SwTextFormatInfo &rInf )
    return false;
};

bool SwControlCharPortion::DoPaint(SwTextPaintInfo const&,
bool SwControlCharPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo,
        OUString & rOutString, SwFont & rTmpFont, int &) const
{
    if (mcChar == CHAR_WJ || !SwViewOption::IsFieldShadings())
    if (mcChar == CHAR_WJ || !rTextPaintInfo.GetOpt().IsFieldShadings())
    {
        return false;
    }
@@ -676,7 +676,7 @@ bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo,
    auto const nFactor = aSize.Height() > 0 ? (Height() * 95) / aSize.Height() : Height();
    rFont.SetProportion(nFactor);
    rFont.SetWeight(WEIGHT_THIN, rFont.GetActual());
    rFont.SetColor(SwViewOption::GetFieldShadingsColor());
    rFont.SetColor(rTextPaintInfo.GetOpt().GetFieldShadingsColor());
    // reset these to default...
    rFont.SetAlign(ALIGN_BASELINE);
    rFont.SetUnderline(LINESTYLE_NONE);
@@ -813,7 +813,7 @@ void SwBookmarkPortion::Paint( const SwTextPaintInfo &rInf ) const
        // set bold for custom colored bookmark symbol
        // and draw multiple symbols showing all custom colors
        aTmpFont.SetWeight( COL_TRANSPARENT == std::get<1>(it) ? WEIGHT_THIN : WEIGHT_BOLD, aTmpFont.GetActual() );
        aTmpFont.SetColor( COL_TRANSPARENT == std::get<1>(it) ? SwViewOption::GetFieldShadingsColor() : std::get<1>(it) );
        aTmpFont.SetColor( COL_TRANSPARENT == std::get<1>(it) ? rInf.GetOpt().GetFieldShadingsColor() : std::get<1>(it) );
        aOutString = OUString(std::get<0>(it) == SwScriptInfo::MarkKind::Start ? '[' : ']');

        // MarkKind::Point: drawn I-beam (e.g. U+2336) as overlapping ][
diff --git a/sw/source/core/text/portox.cxx b/sw/source/core/text/portox.cxx
index 982ec4f..bd72e83 100644
--- a/sw/source/core/text/portox.cxx
+++ b/sw/source/core/text/portox.cxx
@@ -48,7 +48,7 @@ sal_uInt16 SwIsoToxPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
    // nViewWidth need to be calculated
    if( !Width() && rInf.OnWin() &&
        !rInf.GetOpt().IsPagePreview() &&
            !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings()   )
            !rInf.GetOpt().IsReadonly() && rInf.GetOpt().IsFieldShadings()   )
    {
        if( !m_nViewWidth )
            pThis->m_nViewWidth = rInf.GetTextSize(OUString(' ')).Width();
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 89df5fc..0b83041 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -705,12 +705,12 @@ void SwTextInputFieldPortion::Paint( const SwTextPaintInfo &rInf ) const

        if (aIntersect.HasArea()
            && rInf.OnWin()
            && SwViewOption::IsFieldShadings()
            && rInf.GetOpt().IsFieldShadings()
            && !rInf.GetOpt().IsPagePreview())
        {
            OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
            pOut->Push(vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR);
            pOut->SetFillColor(SwViewOption::GetFieldShadingsColor());
            pOut->SetFillColor(rInf.GetOpt().GetFieldShadingsColor());
            pOut->SetLineColor();
            pOut->DrawRect(aIntersect.SVRect());
            pOut->Pop();
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index f139cb4..afbe3b1 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -325,7 +325,7 @@ void SwDropPortion::PaintText( const SwTextPaintInfo &rInf ) const
        const_cast<SwDropPortion*>(this)->SetJoinBorderWithPrev(pCurrPart->GetJoinBorderWithPrev());

        if ( rInf.OnWin() &&
            !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() &&
            !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && rInf.GetOpt().IsFieldShadings() &&
            (!pCurrPart->GetFont().GetBackColor() || *pCurrPart->GetFont().GetBackColor() == COL_TRANSPARENT) )
        {
            rInf.DrawBackground( *this );
@@ -398,7 +398,7 @@ void SwDropPortion::Paint( const SwTextPaintInfo &rInf ) const
        return;

    if ( rInf.OnWin() &&
        !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings()       )
        !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() && rInf.GetOpt().IsFieldShadings()       )
        rInf.DrawBackground( *this );

    // make sure that font is not rotated
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 0387246..e125906 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2212,7 +2212,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
                    nNewColor = COL_BLACK;
                else
                    // we take the font color from the appearance page
                    nNewColor = SwViewOption::GetFontColor();
                    nNewColor = pViewOption->GetFontColor();
            }

            // change painting color depending of dark/bright background
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 0ca4026..3f427ed 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -300,7 +300,7 @@ Color SwViewShellImp::GetRetoucheColor() const
                    !officecfg::Office::Common::Accessibility::IsForPagePreviews::get())
            aRet = COL_WHITE;
        else
            aRet = SwViewOption::GetDocColor();
            aRet = rSh.GetViewOptions()->GetDocColor();
    }
    return aRet;
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index d7b548d..e59c80a 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1690,7 +1690,7 @@ void SwViewShell::PaintDesktop_(const SwRegionRects &rRegion)

        // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
        // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
        GetOut()->SetFillColor( SwViewOption::GetAppBackgroundColor());
        GetOut()->SetFillColor( GetViewOptions()->GetAppBackgroundColor());
        GetOut()->SetLineColor();
        GetOut()->DrawRect(aRectangle);

@@ -2214,6 +2214,7 @@ void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt )
        if(&rSh == this)
            continue;
        SwViewOption aOpt( *rSh.GetViewOptions() );
        aOpt.SetColorConfig( rOpt.GetColorConfig() );
        aOpt.SetFieldName( rOpt.IsFieldName() );
        aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
        aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index 765ef16..6d37a88 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -25,6 +25,9 @@
#include <o3tl/string_view.hxx>
#include <fmtfld.hxx>
#include <doc.hxx>
#include <docsh.hxx>
#include <view.hxx>
#include <wrtsh.hxx>
#include <breakit.hxx>
#include <ndtxt.hxx>
#include <txtfld.hxx>
@@ -540,7 +543,8 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, const SfxPoolItem& rHt 
        if( pTextField )
        {
            // ReqIF-XHTML doesn't allow specifying a background color.
            bool bFieldShadings = SwViewOption::IsFieldShadings() && !rWrt.mbReqIF;
            const SwViewOption* pViewOptions = rWrt.m_pDoc->GetDocShell()->GetView()->GetWrtShell().GetViewOptions();
            bool bFieldShadings = pViewOptions->IsFieldShadings() && !rWrt.mbReqIF;
            if (bFieldShadings)
            {
                // If there is a text portion background started already, that should have priority.
@@ -557,7 +561,7 @@ SwHTMLWriter& OutHTML_SwFormatField( SwHTMLWriter& rWrt, const SfxPoolItem& rHt 
                sOut.append(sCSS1_P_background);
                sOut.append(": ");

                Color& rColor = SwViewOption::GetFieldShadingsColor();
                const Color& rColor = pViewOptions->GetFieldShadingsColor();
                sOut.append(GetCSS1_Color(rColor));
                sOut.append("\">");
                rWrt.Strm().WriteOString(sOut);
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 46389d8..e7ff4a6 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -242,9 +242,11 @@ void SwDropCapsPict::UpdatePaintSettings()
    maCJKFont.SetTransparent(true);
    maCTLFont.SetTransparent(true);

    aFont.SetColor( SwViewOption::GetFontColor() );
    maCJKFont.SetColor( SwViewOption::GetFontColor() );
    maCTLFont.SetColor( SwViewOption::GetFontColor() );
    const Color& rFontColor = mpPage->m_rSh.GetViewOptions()->GetFontColor();

    aFont.SetColor( rFontColor );
    maCJKFont.SetColor( rFontColor );
    maCTLFont.SetColor( rFontColor );

    aFont.SetFillColor(Application::GetSettings().GetStyleSettings().GetWindowColor());
    maCJKFont.SetFillColor(Application::GetSettings().GetStyleSettings().GetWindowColor());
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 890ff79..6fd2e17 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1390,9 +1390,10 @@ void SwMarkPreview::InitColors()
    m_aBgCol = rSettings.GetWindowColor();

    bool bHC = rSettings.GetHighContrastMode();
    m_aLineCol = bHC? SwViewOption::GetFontColor() : COL_BLACK;
    const Color& rFontColor = SwViewOption::GetCurrentViewOptions().GetFontColor();
    m_aLineCol = bHC? rFontColor : COL_BLACK;
    m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor();
    m_aTextCol = bHC? SwViewOption::GetFontColor() : COL_GRAY;
    m_aTextCol = bHC? rFontColor : COL_GRAY;
    m_aPrintAreaCol = m_aTextCol;
}

diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index b8c990c..2a690d5 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -71,12 +71,12 @@ void SwEnvPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
        double(aSize.Height()) / double(nPageH));

    Color aBack = rSettings.GetWindowColor();
    Color aFront = SwViewOption::GetFontColor();
    Color aMedium((aBack.GetRed() + aFront.GetRed()) / 2,
                  (aBack.GetGreen() + aFront.GetGreen()) / 2,
                  (aBack.GetBlue() + aFront.GetBlue()) / 2);
    const Color& rFront = SwViewOption::GetCurrentViewOptions().GetFontColor();
    Color aMedium((aBack.GetRed() + rFront.GetRed()) / 2,
                  (aBack.GetGreen() + rFront.GetGreen()) / 2,
                  (aBack.GetBlue() + rFront.GetBlue()) / 2);

    rRenderContext.SetLineColor(aFront);
    rRenderContext.SetLineColor(rFront);

    // Envelope
    const tools::Long nW = static_cast<tools::Long>(f * nPageW);
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index 3f723ca..b90397a 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -74,7 +74,7 @@ void DrawArrow(vcl::RenderContext& rRenderContext, const Point &rP1, const Point
            aArr[2].setY( rP2.Y() );
        }

        const Color& rFieldTextColor = SwViewOption::GetFontColor();
        const Color& rFieldTextColor = SwViewOption::GetCurrentViewOptions().GetFontColor();
        rRenderContext.SetFillColor(rFieldTextColor);
        rRenderContext.DrawPolygon( tools::Polygon(3, aArr));
    }
@@ -150,7 +150,7 @@ void SwLabPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan

    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
    const Color& rWinColor = rStyleSettings.GetWindowColor();
    const Color& rFieldTextColor = SwViewOption::GetFontColor();
    const Color& rFieldTextColor = SwViewOption::GetCurrentViewOptions().GetFontColor();

    vcl::Font aFont = rRenderContext.GetFont();
    aFont.SetFillColor(rWinColor);
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index f98603c..1d4e388 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -872,9 +872,13 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re
    pVDev->SetMapMode(rRenderContext.GetMapMode());
    pVDev->SetOutputSize(aSize);

    const SwViewOption& pOpt = SwViewOption::GetCurrentViewOptions();
    const Color& rDocColor = pOpt.GetDocColor();
    const Color& rDocBoundariesColor = pOpt.GetDocBoundariesColor();
    const Color& rFontColor = pOpt.GetFontColor();
    // #101524# OJ
    pVDev->SetFillColor(SwViewOption::GetDocColor());
    pVDev->SetLineColor(SwViewOption::GetDocBoundariesColor());
    pVDev->SetFillColor(rDocColor);
    pVDev->SetLineColor(rDocBoundariesColor);
    pVDev->DrawRect(tools::Rectangle(Point(0,0), aSize));

    if (m_pActNum)
@@ -897,9 +901,9 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re
                                                GetDefaultFontFlags::OnlyOne, &rRenderContext);

        if (svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO)
            m_aStdFont.SetColor( SwViewOption::GetDocColor().IsDark() ? COL_WHITE : COL_BLACK );
            m_aStdFont.SetColor( rDocColor.IsDark() ? COL_WHITE : COL_BLACK );
        else
            m_aStdFont.SetColor( SwViewOption::GetFontColor() );
            m_aStdFont.SetColor( rFontColor );

        const tools::Long nFontHeight = nYStep * ( m_bPosition ? 15 : 6 ) / 10;
        m_aStdFont.SetFontSize(Size( 0, nFontHeight ));
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 5d6a0a6..a78ba94 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -969,19 +969,20 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, Con
    }
    else if ( pBrdCst == m_pColorConfig.get() )
    {
        if( pBrdCst == m_pColorConfig.get() )
            SwViewOption::ApplyColorConfigValues(*m_pColorConfig);

        //invalidate all edit windows
        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
        while(pViewShell)
        {
            if(pViewShell->GetWindow())
            {
                if(dynamic_cast< const SwView *>( pViewShell ) !=  nullptr ||
                auto pSwView = dynamic_cast<SwView *>( pViewShell );
                if(pSwView !=  nullptr ||
                   dynamic_cast< const SwPagePreview *>( pViewShell ) !=  nullptr ||
                   dynamic_cast< const SwSrcView *>( pViewShell ) !=  nullptr)
                {
                    SwViewOption aNewOptions = *pSwView->GetWrtShell().GetViewOptions();
                    aNewOptions.SetColorConfig(*m_pColorConfig);
                    pSwView->GetWrtShell().ApplyViewOptions(aNewOptions);
                    pViewShell->GetWindow()->Invalidate();
                }
            }
@@ -1044,7 +1045,7 @@ svtools::ColorConfig& SwModule::GetColorConfig()
    if(!m_pColorConfig)
    {
        m_pColorConfig.reset(new svtools::ColorConfig);
        SwViewOption::ApplyColorConfigValues(*m_pColorConfig);
        SwViewOption::SetInitialColorConfig(*m_pColorConfig);
        m_pColorConfig->AddListener(this);
    }
    return *m_pColorConfig;
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index 8b272a0..04dfa0d 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -29,6 +29,9 @@
#include <viewopt.hxx>
#include <wdocsh.hxx>
#include <swrect.hxx>
#include <viewsh.hxx>
#include <view.hxx>
#include <wrtsh.hxx>
#include <crstate.hxx>
#include <authratr.hxx>
#include <svtools/colorcfg.hxx>
@@ -40,29 +43,103 @@
#include <comphelper/lok.hxx>
#include <comphelper/configurationlistener.hxx>

Color SwViewOption::s_aDocBoundColor(COL_LIGHTGRAY);
Color SwViewOption::s_aObjectBoundColor(COL_LIGHTGRAY);
Color SwViewOption::s_aDocColor(COL_LIGHTGRAY);
Color SwViewOption::s_aAppBackgroundColor(COL_LIGHTGRAY);
Color SwViewOption::s_aTableBoundColor(COL_LIGHTGRAY);
Color SwViewOption::s_aIndexShadingsColor(COL_LIGHTGRAY);
Color SwViewOption::s_aLinksColor(COL_BLUE);
Color SwViewOption::s_aVisitedLinksColor(COL_RED);
Color SwViewOption::s_aDirectCursorColor(COL_BLUE);
Color SwViewOption::s_aTextGridColor(COL_LIGHTGRAY);
Color SwViewOption::s_aSpellColor(COL_LIGHTRED);
Color SwViewOption::s_aGrammarColor(COL_LIGHTBLUE);
Color SwViewOption::s_aSmarttagColor(COL_LIGHTMAGENTA);
Color SwViewOption::s_aFontColor(COL_BLACK);
Color SwViewOption::s_aFieldShadingsColor(COL_LIGHTGRAY);
Color SwViewOption::s_aSectionBoundColor(COL_LIGHTGRAY);
Color SwViewOption::s_aPageBreakColor(COL_BLUE);
Color SwViewOption::s_aScriptIndicatorColor(COL_GREEN);
Color SwViewOption::s_aShadowColor(COL_GRAY);
Color SwViewOption::s_aHeaderFooterMarkColor(COL_BLUE);

ViewOptFlags SwViewOption::s_nAppearanceFlags = ViewOptFlags::DocBoundaries|ViewOptFlags::ObjectBoundaries;
sal_uInt16 SwViewOption::s_nPixelTwips = 0;   // one pixel on the screen
SwViewColors SwViewOption::s_aInitialColorConfig {};

SwViewColors::SwViewColors() :
    m_aDocColor(COL_LIGHTGRAY),
    m_aDocBoundColor(COL_LIGHTGRAY),
    m_aObjectBoundColor(COL_LIGHTGRAY),
    m_aAppBackgroundColor(COL_LIGHTGRAY),
    m_aTableBoundColor(COL_LIGHTGRAY),
    m_aFontColor(COL_BLACK),
    m_aIndexShadingsColor(COL_LIGHTGRAY),
    m_aLinksColor(COL_BLUE),
    m_aVisitedLinksColor(COL_RED),
    m_aDirectCursorColor(COL_BLUE),
    m_aTextGridColor(COL_LIGHTGRAY),
    m_aSpellColor(COL_LIGHTRED),
    m_aGrammarColor(COL_LIGHTBLUE),
    m_aSmarttagColor(COL_LIGHTMAGENTA),
    m_aFieldShadingsColor(COL_LIGHTGRAY),
    m_aSectionBoundColor(COL_LIGHTGRAY),
    m_aPageBreakColor(COL_BLUE),
    m_aScriptIndicatorColor(COL_GREEN),
    m_aShadowColor(COL_GRAY),
    m_aHeaderFooterMarkColor(COL_BLUE)
{}

SwViewColors::SwViewColors(const svtools::ColorConfig& rConfig)
{
    m_aDocColor = rConfig.GetColorValue(svtools::DOCCOLOR).nColor;

    svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
    m_aDocBoundColor = aValue.nColor;
    m_nAppearanceFlags = ViewOptFlags::NONE;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::DocBoundaries;

    m_aAppBackgroundColor = rConfig.GetColorValue(svtools::APPBACKGROUND).nColor;

    aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
    m_aObjectBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::ObjectBoundaries;

    aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
    m_aTableBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::TableBoundaries;

    aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
    m_aIndexShadingsColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::IndexShadings;

    aValue = rConfig.GetColorValue(svtools::LINKS);
    m_aLinksColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::Links;

    aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
    m_aVisitedLinksColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::VisitedLinks;

    aValue = rConfig.GetColorValue(svtools::SHADOWCOLOR);
    m_aShadowColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::Shadow;

    m_aDirectCursorColor = rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor;

    m_aTextGridColor = rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor;

    m_aSpellColor = rConfig.GetColorValue(svtools::SPELL).nColor;
    m_aGrammarColor = rConfig.GetColorValue(svtools::GRAMMAR).nColor;

    m_aSmarttagColor = rConfig.GetColorValue(svtools::SMARTTAGS).nColor;

    m_aFontColor = rConfig.GetColorValue(svtools::FONTCOLOR).nColor;

    aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
    m_aFieldShadingsColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::FieldShadings;

    aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
    m_aSectionBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        m_nAppearanceFlags |= ViewOptFlags::SectionBoundaries;

    aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
    m_aPageBreakColor = aValue.nColor;

    aValue = rConfig.GetColorValue(svtools::WRITERHEADERFOOTERMARK);
    m_aHeaderFooterMarkColor = aValue.nColor;

    m_aScriptIndicatorColor = rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor;
}

bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
{
@@ -140,7 +217,7 @@ sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut )
    return sal_uInt16(pOut->GetTextWidth("  "));
}

void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript )
void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript ) const
{
    if( !(pOut && bIsScript) )
        return;
@@ -154,7 +231,7 @@ void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool b
    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, s_aScriptIndicatorColor );
    DrawRect( pOut, aRect,  m_aColorConfig.m_aScriptIndicatorColor );
    pOut->SetLineColor( aOldLineColor );
}

@@ -213,8 +290,9 @@ SwViewOption::SwViewOption() :
    m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 =
             m_bTest5 = m_bTest6 = m_bTest7 = m_bTest8 = m_bTest10 = false;
#endif
    m_aColorConfig = s_aInitialColorConfig;
    if (comphelper::LibreOfficeKit::isActive())
        s_aAppBackgroundColor = COL_TRANSPARENT;
        m_aColorConfig.m_aAppBackgroundColor = COL_TRANSPARENT;
}

SwViewOption::SwViewOption(const SwViewOption& rVOpt)
@@ -247,6 +325,7 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt)
    m_bShowPlaceHolderFields = rVOpt.m_bShowPlaceHolderFields;
    m_bIdle           = rVOpt.m_bIdle;
    m_nDefaultAnchor  = rVOpt.m_nDefaultAnchor;
    m_aColorConfig    = rVOpt.m_aColorConfig;

#ifdef DBG_UTIL
    m_bTest1  = rVOpt.m_bTest1;
@@ -289,6 +368,7 @@ SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
    m_bShowPlaceHolderFields = rVOpt.m_bShowPlaceHolderFields;
    m_bIdle           = rVOpt.m_bIdle;
    m_nDefaultAnchor  = rVOpt.m_nDefaultAnchor;
    m_aColorConfig    = rVOpt.m_aColorConfig;

#ifdef DBG_UTIL
    m_bTest1  = rVOpt.m_bTest1;
@@ -366,179 +446,107 @@ RndStdIds SwViewOption::GetDefaultAnchorType() const
    }//switch
}

Color&   SwViewOption::GetDocColor()
const Color& SwViewOption::GetDocColor() const
{
    return s_aDocColor;
    return m_aColorConfig.m_aDocColor;
}

Color&   SwViewOption::GetDocBoundariesColor()
const Color& SwViewOption::GetDocBoundariesColor() const
{
    return s_aDocBoundColor;
    return m_aColorConfig.m_aDocBoundColor;
}

Color&   SwViewOption::GetObjectBoundariesColor()
const Color& SwViewOption::GetObjectBoundariesColor() const
{
    return s_aObjectBoundColor;
    return m_aColorConfig.m_aObjectBoundColor;
}

Color& SwViewOption::GetAppBackgroundColor()
const Color& SwViewOption::GetAppBackgroundColor() const
{
    return s_aAppBackgroundColor;
    return m_aColorConfig.m_aAppBackgroundColor;
}

Color&   SwViewOption::GetTableBoundariesColor()
const Color& SwViewOption::GetTableBoundariesColor() const
{
    return s_aTableBoundColor;
    return m_aColorConfig.m_aTableBoundColor;
}

Color&   SwViewOption::GetIndexShadingsColor()
const Color& SwViewOption::GetIndexShadingsColor() const
{
    return s_aIndexShadingsColor;
    return m_aColorConfig.m_aIndexShadingsColor;
}

Color&   SwViewOption::GetLinksColor()
const Color& SwViewOption::GetLinksColor() const
{
    return s_aLinksColor;
    return m_aColorConfig.m_aLinksColor;
}

Color&   SwViewOption::GetVisitedLinksColor()
const Color& SwViewOption::GetVisitedLinksColor() const
{
    return s_aVisitedLinksColor;
    return m_aColorConfig.m_aVisitedLinksColor;
}

Color&   SwViewOption::GetDirectCursorColor()
const Color& SwViewOption::GetDirectCursorColor() const
{
    return s_aDirectCursorColor;
    return m_aColorConfig.m_aDirectCursorColor;
}

Color&   SwViewOption::GetTextGridColor()
const Color& SwViewOption::GetTextGridColor() const
{
    return s_aTextGridColor;
    return m_aColorConfig.m_aTextGridColor;
}

Color&   SwViewOption::GetSpellColor()
const Color& SwViewOption::GetSpellColor() const
{
    return s_aSpellColor;
    return m_aColorConfig.m_aSpellColor;
}

Color&   SwViewOption::GetGrammarColor()
const Color& SwViewOption::GetGrammarColor() const
{
    return s_aGrammarColor;
    return m_aColorConfig.m_aGrammarColor;
}

Color&   SwViewOption::GetSmarttagColor()
const Color& SwViewOption::GetSmarttagColor() const
{
    return s_aSmarttagColor;
    return m_aColorConfig.m_aSmarttagColor;
}

Color&   SwViewOption::GetShadowColor()
const Color& SwViewOption::GetShadowColor() const
{
    return s_aShadowColor;
    return m_aColorConfig.m_aShadowColor;
}

Color&   SwViewOption::GetFontColor()
const Color& SwViewOption::GetFontColor() const
{
    return s_aFontColor;
    return m_aColorConfig.m_aFontColor;
}

Color&   SwViewOption::GetFieldShadingsColor()
const Color& SwViewOption::GetFieldShadingsColor() const
{
    return s_aFieldShadingsColor;
    return m_aColorConfig.m_aFieldShadingsColor;
}

Color&   SwViewOption::GetSectionBoundColor()
const Color& SwViewOption::GetSectionBoundColor() const
{
    return s_aSectionBoundColor;
    return m_aColorConfig.m_aSectionBoundColor;
}

Color& SwViewOption::GetPageBreakColor()
const Color& SwViewOption::GetPageBreakColor() const
{
    return s_aPageBreakColor;
    return m_aColorConfig.m_aPageBreakColor;
}

Color& SwViewOption::GetHeaderFooterMarkColor()
const Color& SwViewOption::GetHeaderFooterMarkColor() const
{
    return s_aHeaderFooterMarkColor;
}

void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
{
    s_aDocColor = rConfig.GetColorValue(svtools::DOCCOLOR).nColor;

    svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
    s_aDocBoundColor = aValue.nColor;
    s_nAppearanceFlags = ViewOptFlags::NONE;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::DocBoundaries;

    s_aAppBackgroundColor = rConfig.GetColorValue(svtools::APPBACKGROUND).nColor;

    aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
    s_aObjectBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::ObjectBoundaries;

    aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
    s_aTableBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::TableBoundaries;

    aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
    s_aIndexShadingsColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::IndexShadings;

    aValue = rConfig.GetColorValue(svtools::LINKS);
    s_aLinksColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::Links;

    aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
    s_aVisitedLinksColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::VisitedLinks;

    aValue = rConfig.GetColorValue(svtools::SHADOWCOLOR);
    s_aShadowColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::Shadow;

    s_aDirectCursorColor = rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor;

    s_aTextGridColor = rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor;

    s_aSpellColor = rConfig.GetColorValue(svtools::SPELL).nColor;
    s_aGrammarColor = rConfig.GetColorValue(svtools::GRAMMAR).nColor;

    s_aSmarttagColor = rConfig.GetColorValue(svtools::SMARTTAGS).nColor;

    s_aFontColor = rConfig.GetColorValue(svtools::FONTCOLOR).nColor;

    aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
    s_aFieldShadingsColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::FieldShadings;

    aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
    s_aSectionBoundColor = aValue.nColor;
    if(aValue.bIsVisible)
        s_nAppearanceFlags |= ViewOptFlags::SectionBoundaries;

    aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
    s_aPageBreakColor = aValue.nColor;

    aValue = rConfig.GetColorValue(svtools::WRITERHEADERFOOTERMARK);
    s_aHeaderFooterMarkColor = aValue.nColor;

    s_aScriptIndicatorColor = rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor;
    return m_aColorConfig.m_aHeaderFooterMarkColor;
}

void SwViewOption::SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveInConfig )
{
    if(bSet)
        s_nAppearanceFlags |= nFlag;
        m_aColorConfig.m_nAppearanceFlags |= nFlag;
    else
        s_nAppearanceFlags &= ~nFlag;
        m_aColorConfig.m_nAppearanceFlags &= ~nFlag;
    if(!bSaveInConfig)
        return;

@@ -575,9 +583,9 @@ void SwViewOption::SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveIn
    }
}

bool SwViewOption::IsAppearanceFlag(ViewOptFlags nFlag)
bool SwViewOption::IsAppearanceFlag(ViewOptFlags nFlag) const
{
    return bool(s_nAppearanceFlags & nFlag);
    return bool(m_aColorConfig.m_nAppearanceFlags & nFlag);
}

namespace{
@@ -594,4 +602,18 @@ bool SwViewOption::IsIgnoreProtectedArea()
    return gIgnoreProtectedArea.get();
}

const SwViewOption& SwViewOption::GetCurrentViewOptions()
{
    SfxViewShell* pCurrentShell = SfxViewShell::Current();
    SwView* pView = dynamic_cast<SwView*>(pCurrentShell);
    if(pView)
    {
        return *pView->GetWrtShell().GetViewOptions();
    }

    // Some unit tests don't have a SfxViewShell, so we need to return something
    static SwViewOption aDefaultViewOptions;
    return aDefaultViewOptions;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index eff0c82..677d622 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -352,14 +352,14 @@ void SwAnnotationWin::InitControls()
    EEControlBits nCntrl = mpOutliner->GetControlWord();
    // TODO: crash when AUTOCOMPLETE enabled
    nCntrl |= EEControlBits::MARKFIELDS | EEControlBits::PASTESPECIAL | EEControlBits::AUTOCORRECT | EEControlBits::USECHARATTRIBS; // | EEControlBits::AUTOCOMPLETE;
    if (SwViewOption::IsFieldShadings())
        nCntrl |= EEControlBits::MARKFIELDS;
    else
        nCntrl &= ~EEControlBits::MARKFIELDS;

    if (SwWrtShell* pWrtShell = mrView.GetWrtShellPtr())
    {
        const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
        if (pVOpt->IsFieldShadings())
            nCntrl |= EEControlBits::MARKFIELDS;
        else
            nCntrl &= ~EEControlBits::MARKFIELDS;
        if (pVOpt->IsOnlineSpell())
            nCntrl |= EEControlBits::ONLINESPELLING;
        else
diff --git a/sw/source/uibase/docvw/DashedLine.cxx b/sw/source/uibase/docvw/DashedLine.cxx
index 2ec691b..0ede6da 100644
--- a/sw/source/uibase/docvw/DashedLine.cxx
+++ b/sw/source/uibase/docvw/DashedLine.cxx
@@ -19,7 +19,7 @@
#include <vcl/settings.hxx>
#include <memory>

SwDashedLine::SwDashedLine( vcl::Window* pParent, Color& ( *pColorFn )() )
SwDashedLine::SwDashedLine( vcl::Window* pParent, const Color& ( SwViewOption::* pColorFn )() const )
    : Control( pParent, WB_DIALOGCONTROL | WB_HORZ )
    , m_pColorFn( pColorFn )
{
@@ -51,7 +51,7 @@ void SwDashedLine::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
    const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();

    std::vector<double> aStrokePattern;
    basegfx::BColor aColor = m_pColorFn().getBColor();
    basegfx::BColor aColor = (SwViewOption::GetCurrentViewOptions().*m_pColorFn)().getBColor();
    if (rSettings.GetHighContrastMode())
    {
        // Only a solid line in high contrast mode
@@ -82,7 +82,7 @@ void SwDashedLine::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
    aSeq[aSeq.size() - 1] =
            new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
                basegfx::B2DPolyPolygon(aPolygon),
                drawinglayer::attribute::LineAttribute(m_pColorFn().getBColor()),
                drawinglayer::attribute::LineAttribute((SwViewOption::GetCurrentViewOptions().*m_pColorFn)().getBColor()),
                drawinglayer::attribute::StrokeAttribute(std::move(aStrokePattern)));

    pProcessor->process(aSeq);
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 186deaa..654e6be 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -132,7 +132,7 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon
    B2DPolygon aPolygon = lcl_GetPolygon(rRect, bOnTop);

    // Colors
    basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
    basegfx::BColor aLineColor = SwViewOption::GetCurrentViewOptions().GetHeaderFooterMarkColor().getBColor();
    basegfx::BColor aFillColor = lcl_GetFillColor(aLineColor);
    basegfx::BColor aLighterColor = lcl_GetLighterGradientColor(aFillColor);

@@ -362,7 +362,7 @@ void SwHeaderFooterWin::PaintButton()
    SwFrameButtonPainter::PaintButton(aSeq, aRect, m_bIsHeader);

    // Create the text primitive
    basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
    basegfx::BColor aLineColor = SwViewOption::GetCurrentViewOptions().GetHeaderFooterMarkColor().getBColor();
    B2DVector aFontSize;
    FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_xVirDev->GetFont(), false, false);

diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index 1af0302..398dfd2 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -174,7 +174,7 @@ void SwPageBreakWin::PaintButton()
    const ::tools::Rectangle aRect(::tools::Rectangle(Point(0, 0), m_xVirDev->PixelToLogic(GetSizePixel())));

    // Properly paint the control
    BColor aColor = SwViewOption::GetPageBreakColor().getBColor();
    BColor aColor = SwViewOption::GetCurrentViewOptions().GetPageBreakColor().getBColor();

    BColor aHslLine = rgb2hsl(aColor);
    double nLuminance = aHslLine.getZ();
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index 79443c3..e1cdf8c 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -207,7 +207,8 @@ void UnfloatTableButton::PaintButton()
    SwFrameButtonPainter::PaintButton(aSeq, aRect, true);

    // Create the text primitive
    basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
    basegfx::BColor aLineColor
        = SwViewOption::GetCurrentViewOptions().GetHeaderFooterMarkColor().getBColor();
    basegfx::B2DVector aFontSize;
    drawinglayer::attribute::FontAttribute aFontAttr
        = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_xVirDev->GetFont(),
diff --git a/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx b/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx
index abb792d..0d11b5c 100644
--- a/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx
+++ b/sw/source/uibase/docvw/contentcontrolaliasbutton.cxx
@@ -102,7 +102,8 @@ void SwContentControlAliasButton::PaintButton()
    SwFrameButtonPainter::PaintButton(aSeq, aRect, /*bOnTop=*/false);

    // Create the text primitive
    basegfx::BColor aLineColor = SwViewOption::GetHeaderFooterMarkColor().getBColor();
    const SwViewOption* pVOpt = GetEditWin()->GetView().GetWrtShell().GetViewOptions();
    basegfx::BColor aLineColor = pVOpt->GetHeaderFooterMarkColor().getBColor();
    basegfx::B2DVector aFontSize;
    drawinglayer::attribute::FontAttribute aFontAttr
        = drawinglayer::primitive2d::getFontAttributeFromVclFont(aFontSize, m_xVirDev->GetFont(),
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index b7a63bd..50ad58e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4550,7 +4550,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
                    {
                        if( !m_pShadCursor )
                            m_pShadCursor.reset( new SwShadowCursor( *this,
                                SwViewOption::GetDirectCursorColor() ) );
                                rSh.GetViewOptions()->GetDirectCursorColor() ) );
                        if( text::HoriOrientation::RIGHT != eOrient && text::HoriOrientation::CENTER != eOrient )
                            eOrient = text::HoriOrientation::LEFT;
                        m_pShadCursor->SetPos( aRect.Pos(), aRect.Height(), static_cast< sal_uInt16 >(eOrient) );
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index 8649a33..b77512b 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -340,7 +340,7 @@ void SwColumnOnlyExample::Paint(vcl::RenderContext& rRenderContext, const tools:
    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
    const Color& rFieldColor = rStyleSettings.GetFieldColor();
    const Color& rDlgColor = rStyleSettings.GetDialogColor();
    const Color& rFieldTextColor = SwViewOption::GetFontColor();
    const Color& rFieldTextColor = SwViewOption::GetCurrentViewOptions().GetFontColor();
    Color aGrayColor(COL_LIGHTGRAY);
    if (rFieldColor == aGrayColor)
        aGrayColor.Invert();
diff --git a/sw/source/uibase/inc/DashedLine.hxx b/sw/source/uibase/inc/DashedLine.hxx
index a2d2aa1..f4b808e 100644
--- a/sw/source/uibase/inc/DashedLine.hxx
+++ b/sw/source/uibase/inc/DashedLine.hxx
@@ -10,15 +10,16 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_DASHEDLINE_HXX

#include <vcl/ctrl.hxx>
#include <viewopt.hxx>

/** Class for displaying a dashed line in the Writer GUI.
  */
class SwDashedLine : public Control
{
    Color& (*m_pColorFn)();
    const Color& (SwViewOption::*m_pColorFn)() const;

public:
    SwDashedLine(vcl::Window* pParent, Color& (*pColorFn)());
    SwDashedLine(vcl::Window* pParent, const Color& (SwViewOption::*pColorFn)() const);
    virtual ~SwDashedLine() override;

    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index a9044776..ba55557 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -142,13 +142,13 @@ static bool lcl_IsViewMarks( const SwViewOption& rVOpt )
{
    return  rVOpt.IsHardBlank() &&
            rVOpt.IsSoftHyph() &&
            SwViewOption::IsFieldShadings();
            rVOpt.IsFieldShadings();
}
static void lcl_SetViewMarks(SwViewOption& rVOpt, bool bOn )
{
    rVOpt.SetHardBlank(bOn);
    rVOpt.SetSoftHyph(bOn);
    SwViewOption::SetAppearanceFlag(
    rVOpt.SetAppearanceFlag(
            ViewOptFlags::FieldShadings, bOn, true);
}

@@ -253,13 +253,13 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
            }
            break;
            case FN_VIEW_BOUNDS:
                aBool.SetValue( SwViewOption::IsDocBoundaries()); break;
                aBool.SetValue( pOpt->IsDocBoundaries()); break;
            case FN_VIEW_SECTION_BOUNDARIES:
                aBool.SetValue(SwViewOption::IsSectionBoundaries()); break;
                aBool.SetValue(pOpt->IsSectionBoundaries()); break;
            case FN_VIEW_GRAPHIC:
                aBool.SetValue( pOpt->IsGraphic() ); break;
            case FN_VIEW_FIELDS:
                aBool.SetValue( SwViewOption::IsFieldShadings() ); break;
                aBool.SetValue( pOpt->IsFieldShadings() ); break;
            case FN_VIEW_FIELDNAME:
                aBool.SetValue( pOpt->IsFieldName() ); break;
            case FN_VIEW_MARKS:
@@ -267,7 +267,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
            case FN_VIEW_META_CHARS:
                aBool.SetValue( pOpt->IsViewMetaChars() ); break;
            case FN_VIEW_TABLEGRID:
                aBool.SetValue( SwViewOption::IsTableBoundaries() ); break;
                aBool.SetValue( pOpt->IsTableBoundaries() ); break;
            case SID_TOGGLE_NOTES:
            {
                if (!GetPostItMgr()->HasNotes())
@@ -404,20 +404,20 @@ void SwView::ExecViewOptions(SfxRequest &rReq)

    case FN_VIEW_FIELDS:
        if( STATE_TOGGLE == eState )
            bFlag = !SwViewOption::IsFieldShadings() ;
        SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, bFlag, true );
            bFlag = !pOpt->IsFieldShadings() ;
        pOpt->SetAppearanceFlag(ViewOptFlags::FieldShadings, bFlag, true );
        break;

    case FN_VIEW_BOUNDS:
        if( STATE_TOGGLE == eState )
            bFlag = !SwViewOption::IsDocBoundaries();
        SwViewOption::SetAppearanceFlag(ViewOptFlags::DocBoundaries, bFlag, true );
            bFlag = !pOpt->IsDocBoundaries();
        pOpt->SetAppearanceFlag(ViewOptFlags::DocBoundaries, bFlag, true );
        break;

    case FN_VIEW_SECTION_BOUNDARIES:
        if( STATE_TOGGLE == eState )
            bFlag = !SwViewOption::IsSectionBoundaries();
        SwViewOption::SetAppearanceFlag(ViewOptFlags::SectionBoundaries, bFlag, true );
            bFlag = !pOpt->IsSectionBoundaries();
        pOpt->SetAppearanceFlag(ViewOptFlags::SectionBoundaries, bFlag, true );
        break;

    case SID_GRID_VISIBLE:
@@ -531,8 +531,8 @@ void SwView::ExecViewOptions(SfxRequest &rReq)

    case FN_VIEW_TABLEGRID:
        if( STATE_TOGGLE == eState )
            bFlag = !SwViewOption::IsTableBoundaries();
        SwViewOption::SetAppearanceFlag(ViewOptFlags::TableBoundaries, bFlag, true );
            bFlag = !pOpt->IsTableBoundaries();
        pOpt->SetAppearanceFlag(ViewOptFlags::TableBoundaries, bFlag, true );
        break;

    case FN_VIEW_FIELDNAME:
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 35c3c31..9e718ee 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -524,7 +524,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,

        const SwViewOption *pOpt = pSh->GetViewOptions();

        if (SwViewOption::IsFieldShadings())
        if (pOpt->IsFieldShadings())
            nCntrl |= EEControlBits::MARKFIELDS;
        else
            nCntrl &= ~EEControlBits::MARKFIELDS;
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 1506d197..a4f1def 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -575,10 +575,10 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
        case  HANDLE_VIEWSET_DRAWINGS              :   mpViewOption->SetDraw(*o3tl::doAccess<bool>(rValue)); break;
        case  HANDLE_VIEWSET_FIELD_COMMANDS        :   mpViewOption->SetFieldName(*o3tl::doAccess<bool>(rValue));  break;
        case  HANDLE_VIEWSET_ANNOTATIONS           :   mpViewOption->SetPostIts(*o3tl::doAccess<bool>(rValue));  break;
        case  HANDLE_VIEWSET_INDEX_MARK_BACKGROUND :   SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true);  break;
        case  HANDLE_VIEWSET_INDEX_MARK_BACKGROUND :   mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true);  break;
        case  HANDLE_VIEWSET_NONPRINTING_CHARACTERS:   mpViewOption->SetViewMetaChars( *o3tl::doAccess<bool>(rValue) ); break;
        case  HANDLE_VIEWSET_FOOTNOTE_BACKGROUND   :   SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
        case  HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND :   SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true);    break;
        case  HANDLE_VIEWSET_FOOTNOTE_BACKGROUND   :   mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
        case  HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND :   mpViewOption->SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true);    break;
        case  HANDLE_VIEWSET_PARA_BREAKS           :   mpViewOption->SetParagraph(*o3tl::doAccess<bool>(rValue));    break;
        case  HANDLE_VIEWSET_SOFT_HYPHENS          :   mpViewOption->SetSoftHyph(*o3tl::doAccess<bool>(rValue)); break;
        case  HANDLE_VIEWSET_SPACES                :   mpViewOption->SetBlank(*o3tl::doAccess<bool>(rValue));    break;
@@ -589,8 +589,8 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
        case  HANDLE_VIEWSET_HIDDEN_TEXT           :   mpViewOption->SetShowHiddenField(*o3tl::doAccess<bool>(rValue));  break;
        case  HANDLE_VIEWSET_HIDDEN_CHARACTERS     :   mpViewOption->SetShowHiddenChar(*o3tl::doAccess<bool>(rValue)); break;
        case  HANDLE_VIEWSET_HIDDEN_PARAGRAPHS     :   mpViewOption->SetShowHiddenPara(*o3tl::doAccess<bool>(rValue));   break;
        case  HANDLE_VIEWSET_TABLE_BOUNDARIES      :   SwViewOption::SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess<bool>(rValue), true);    break;
        case  HANDLE_VIEWSET_TEXT_BOUNDARIES       :   SwViewOption::SetDocBoundaries(*o3tl::doAccess<bool>(rValue));    break;
        case  HANDLE_VIEWSET_TABLE_BOUNDARIES      :   mpViewOption->SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess<bool>(rValue), true);    break;
        case  HANDLE_VIEWSET_TEXT_BOUNDARIES       :   mpViewOption->SetDocBoundaries(*o3tl::doAccess<bool>(rValue));    break;
        case  HANDLE_VIEWSET_SMOOTH_SCROLLING      :   mpViewOption->SetSmoothScroll(*o3tl::doAccess<bool>(rValue)); break;
        case  HANDLE_VIEWSET_SHOW_CONTENT_TIPS     :   mpViewOption->SetShowContentTips(*o3tl::doAccess<bool>(rValue)); break;
        case  HANDLE_VIEWSET_IS_RASTER_VISIBLE     : mpViewOption->SetGridVisible(*o3tl::doAccess<bool>(rValue)); break;
@@ -820,10 +820,10 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
        case  HANDLE_VIEWSET_DRAWINGS              :   bBoolVal = mpConstViewOption->IsDraw();  break;
        case  HANDLE_VIEWSET_FIELD_COMMANDS        :   bBoolVal = mpConstViewOption->IsFieldName();   break;
        case  HANDLE_VIEWSET_ANNOTATIONS           :   bBoolVal = mpConstViewOption->IsPostIts();   break;
        case  HANDLE_VIEWSET_INDEX_MARK_BACKGROUND :   bBoolVal = SwViewOption::IsFieldShadings();   break;
        case  HANDLE_VIEWSET_INDEX_MARK_BACKGROUND :   bBoolVal = mpConstViewOption->IsFieldShadings();   break;
        case  HANDLE_VIEWSET_NONPRINTING_CHARACTERS:   bBoolVal = mpConstViewOption->IsViewMetaChars(); break;
        case  HANDLE_VIEWSET_FOOTNOTE_BACKGROUND   :   bBoolVal = SwViewOption::IsFieldShadings();  break;
        case  HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND :   bBoolVal = SwViewOption::IsFieldShadings(); break;
        case  HANDLE_VIEWSET_FOOTNOTE_BACKGROUND   :   bBoolVal = mpConstViewOption->IsFieldShadings();  break;
        case  HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND :   bBoolVal = mpConstViewOption->IsFieldShadings(); break;
        case  HANDLE_VIEWSET_PARA_BREAKS           :   bBoolVal = mpConstViewOption->IsParagraph(true); break;
        case  HANDLE_VIEWSET_SOFT_HYPHENS          :   bBoolVal = mpConstViewOption->IsSoftHyph();  break;
        case  HANDLE_VIEWSET_SPACES                :   bBoolVal = mpConstViewOption->IsBlank(true); break;
@@ -835,8 +835,8 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
        case  HANDLE_VIEWSET_HIDDEN_CHARACTERS     :   bBoolVal = mpConstViewOption->IsShowHiddenChar(true); break;
        case  HANDLE_VIEWSET_HIDE_WHITESPACE       :   bBoolVal = mpConstViewOption->IsHideWhitespaceMode(); break;
        case  HANDLE_VIEWSET_HIDDEN_PARAGRAPHS     :   bBoolVal = mpConstViewOption->IsShowHiddenPara();    break;
        case  HANDLE_VIEWSET_TABLE_BOUNDARIES      :   bBoolVal = SwViewOption::IsTableBoundaries(); break;
        case  HANDLE_VIEWSET_TEXT_BOUNDARIES       :   bBoolVal = SwViewOption::IsDocBoundaries(); break;
        case  HANDLE_VIEWSET_TABLE_BOUNDARIES      :   bBoolVal = mpConstViewOption->IsTableBoundaries(); break;
        case  HANDLE_VIEWSET_TEXT_BOUNDARIES       :   bBoolVal = mpConstViewOption->IsDocBoundaries(); break;
        case  HANDLE_VIEWSET_SMOOTH_SCROLLING      :   bBoolVal = mpConstViewOption->IsSmoothScroll();  break;
        case  HANDLE_VIEWSET_SHOW_CONTENT_TIPS     :   bBoolVal = mpConstViewOption->IsShowContentTips(); break;
        case  HANDLE_VIEWSET_INLINECHANGES_TIPS    :   bBoolVal = mpConstViewOption->IsShowInlineTooltips(); break;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index ece2058..57ed9d0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3598,7 +3598,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
    aViewOption.SetHardBlank(false);

    // Disable field shadings: the result would depend on the cursor position.
    SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, false);
    aViewOption.SetAppearanceFlag(ViewOptFlags::FieldShadings, false);

    OUString sOrigAuthor = SW_MOD()->GetRedlineAuthor(SW_MOD()->GetRedlineAuthor());
    OUString sAuthor;
@@ -3608,7 +3608,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
        if (rValue.Name == ".uno:HideWhitespace" && rValue.Value.has<bool>())
            aViewOption.SetHideWhitespaceMode(rValue.Value.get<bool>());
        else if (rValue.Name == ".uno:ShowBorderShadow" && rValue.Value.has<bool>())
            SwViewOption::SetAppearanceFlag(ViewOptFlags::Shadow , rValue.Value.get<bool>());
            aViewOption.SetAppearanceFlag(ViewOptFlags::Shadow , rValue.Value.get<bool>());
        else if (rValue.Name == ".uno:Author" && rValue.Value.has<OUString>())
        {
            sAuthor = rValue.Value.get<OUString>();