diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-05-12 13:19:56 +0000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-05-14 03:23:20 +0200 |
commit | ea191cf9807d0b0725fbc4831053a26ba71c2328 (patch) | |
tree | 024439b27c65e0dd8e324ccebb6c26757186e12a /starmath/source/edit.cxx | |
parent | d14d1341f2b0cd62098425b36438ae20b887fe93 (diff) |
tdf#90297 use field colors for math's edit engine
This adds a maTextColor to the EditEngine, which will override
the default AutoColor.
There is also a NOCOLORS mode and I thought about using it
instead, but it defaults to COL_BLACK and overriding this seems
wrong.
Since the EditEngine does the whole drawing and now has the
explicit FieldColor() and FieldTextColor() for background and
text, my guess is we don't need an ApplySettings implementation.
Change-Id: I6c2ecc843a3e07de98f97c86fc00a3b83cb78d97
Reviewed-on: https://gerrit.libreoffice.org/72197
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'starmath/source/edit.cxx')
-rw-r--r-- | starmath/source/edit.cxx | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index b16b67409943..76c10fe6536d 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -86,8 +86,6 @@ SmEditWindow::SmEditWindow( SmCmdBoxWindow &rMyCmdBoxWin ) : // Even RTL languages don't use RTL for math EnableRTL( false ); - ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); - // compare DataChanged SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); @@ -190,25 +188,15 @@ EditEngine * SmEditWindow::GetEditEngine() return pEditEng; } -void SmEditWindow::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg ) -{ - // Note: SetBackground still done in SmEditWindow::DataChanged - SetTextColor( rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor ); - Invalidate(); -} - -void SmEditWindow::DataChanged( const DataChangedEvent& ) +void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt ) { - const StyleSettings aSettings( GetSettings().GetStyleSettings() ); - - // FIXME RenderContext + Window::DataChanged( rDCEvt ); - ApplyColorConfigValues( SM_MOD()->GetColorConfig() ); - SetBackground( aSettings.GetWindowColor() ); - - // edit fields in other Applications use this font instead of - // the application font thus we use this one too - SetPointFont(*this, aSettings.GetFieldFont() /*aSettings.GetAppFont()*/); + if (!((rDCEvt.GetType() == DataChangedEventType::FONTS) || + (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || + ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)))) + return; EditEngine *pEditEngine = GetEditEngine(); SmDocShell *pDoc = GetDoc(); @@ -218,10 +206,13 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) //! //! see also SmDocShell::GetEditEngine() ! //! + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX"))); + pDoc->UpdateEditEngineDefaultFonts(); - SetEditEngineDefaultFonts(pDoc->GetEditEngineItemPool(), pDoc->GetLinguOptions()); + pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX"))); + pEditEngine->SetTextColor(rStyleSettings.GetFieldTextColor()); + pEditEngine->SetBackgroundColor(rStyleSettings.GetFieldColor()); // forces new settings to be used // unfortunately this resets the whole edit engine @@ -229,10 +220,12 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) OUString aTxt( pEditEngine->GetText() ); pEditEngine->Clear(); //incorrect font size pEditEngine->SetText( aTxt ); + + AdjustScrollBars(); + Resize(); } - AdjustScrollBars(); - Resize(); + Invalidate(); } IMPL_LINK_NOARG( SmEditWindow, ModifyTimerHdl, Timer *, void ) @@ -349,7 +342,6 @@ void SmEditWindow::Command(const CommandEvent& rCEvt) } } - bool SmEditWindow::HandleWheelCommands( const CommandEvent &rCEvt ) { bool bCommandHandled = false; // true if the CommandEvent needs not |