diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2020-10-29 15:03:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-11-03 22:02:24 +0100 |
commit | 6f3899b27156591e65f62649a92c727eb6f5dd03 (patch) | |
tree | 742b41745e770fbf73ada4d5cea395a262219813 /svx/source/dialog | |
parent | 2a7a62c09582ec24247022a94e929610d141a4c9 (diff) |
Resolves tdf#137059 - Use application colors for font preview
Background is set to document's application color now
(options > application colors > document) to provide
a true WYSIWYG experience (except for modifications
to the page background color).
Change-Id: Ifd78e667f3eeff3573ff09bcb4d2a9634dd49c99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105011
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/dialog')
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index edf8b7881297..1b2eb421aad3 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -191,7 +191,7 @@ public: SvtLanguageOptions aLanguageOptions; m_bCJKEnabled = aLanguageOptions.IsAnyEnabled(); m_bCTLEnabled = aLanguageOptions.IsCTLFontEnabled(); - + mxBackColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; Invalidate100PercentFontWidth(); } @@ -501,13 +501,8 @@ static void SetPrevFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEs void SvxFontPrevWindow::ApplySettings(vcl::RenderContext& rRenderContext) { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - svtools::ColorConfig aColorConfig; - Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor); - rRenderContext.SetTextColor(aTextColor); - - rRenderContext.SetBackground(rStyleSettings.GetWindowColor()); + rRenderContext.SetTextColor( svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + rRenderContext.SetBackground( svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor ); } void SvxFontPrevWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) @@ -596,12 +591,6 @@ void SvxFontPrevWindow::ResetColor() Invalidate(); } -void SvxFontPrevWindow::SetBackColor(const Color &rColor) -{ - pImpl->mxBackColor = rColor; - Invalidate(); -} - void SvxFontPrevWindow::SetTextLineColor(const Color &rColor) { pImpl->mxTextLineColor = rColor; @@ -839,17 +828,19 @@ void SvxFontPrevWindow::SetFontWidthScale( sal_uInt16 n ) void SvxFontPrevWindow::AutoCorrectFontColor() { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Color aFontColor(rStyleSettings.GetWindowTextColor()); - - if (COL_AUTO == pImpl->maFont.GetColor()) - pImpl->maFont.SetColor(aFontColor); - - if (COL_AUTO == pImpl->maCJKFont.GetColor()) - pImpl->maCJKFont.SetColor(aFontColor); - - if (COL_AUTO == pImpl->maCTLFont.GetColor()) - pImpl->maCTLFont.SetColor(aFontColor); + Color aColor(COL_AUTO); + if ( pImpl->mxBackColor ) aColor = *pImpl->mxBackColor; + const bool bIsDark(aColor.IsDark()); + + aColor = pImpl->maFont.GetColor(); + if (aColor == COL_AUTO) + pImpl->maFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK ); + aColor = pImpl->maCJKFont.GetColor(); + if (aColor == COL_AUTO) + pImpl->maCJKFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK ); + aColor = pImpl->maCTLFont.GetColor(); + if (aColor == COL_AUTO) + pImpl->maCTLFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK ); } void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont ) @@ -1017,18 +1008,6 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack rCJKFont.SetTransparent( bTransparent ); rCTLFont.SetTransparent( bTransparent ); - Color aBackCol( COL_TRANSPARENT ); - if( !bPreviewBackgroundToCharacter ) - { - if( GetWhich( rSet, SID_ATTR_BRUSH, nWhich ) ) - { - const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) ); - if( GPOS_NONE == rBrush.GetGraphicPos() ) - aBackCol = rBrush.GetColor(); - } - } - SetBackColor( aBackCol ); - // Font SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont ); SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont ); |