summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-05-12 13:19:56 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-05-15 19:37:58 +0200
commitf9c94cfdde6c0af621cf80467a9d83c789699093 (patch)
treecefdc576502e46dca563399ba4cbbd621d9a416e
parent78523a2d03c95843c417c869bc90e14cfd267bcb (diff)
tdf#90297 set default SmEditWindow background
This implements ApplySetting for the proper background of the undocked SfxDockingWindow. In addition, like all other code, this sets the text color via the EditEngine font objects and therefore reverts the uneeded EditEngine interface from the original commit ea191cf9807d ("tdf#90297 use field colors for math's edit engine"). Change-Id: Ib7df4ce730da92a1e41f58b8348a5aec18208166 Reviewed-on: https://gerrit.libreoffice.org/72312 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--editeng/source/editeng/editeng.cxx10
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--editeng/source/editeng/impedit2.cxx1
-rw-r--r--editeng/source/editeng/impedit3.cxx4
-rw-r--r--include/editeng/editeng.hxx2
-rw-r--r--starmath/inc/document.hxx2
-rw-r--r--starmath/inc/edit.hxx1
-rw-r--r--starmath/source/document.cxx8
-rw-r--r--starmath/source/edit.cxx12
9 files changed, 15 insertions, 29 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 5faf9eb9f3f3..458f71b34d3f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -183,16 +183,6 @@ Color const & EditEngine::GetBackgroundColor() const
return pImpEditEngine->GetBackgroundColor();
}
-void EditEngine::SetTextColor( const Color& rColor )
-{
- pImpEditEngine->SetTextColor( rColor );
-}
-
-Color const & EditEngine::GetTextColor() const
-{
- return pImpEditEngine->GetTextColor();
-}
-
Color EditEngine::GetAutoColor() const
{
return pImpEditEngine->GetAutoColor();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 987281ef89e4..9f0e27909515 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -463,7 +463,6 @@ private:
EditSelectionEngine aSelEngine;
Color maBackgroundColor;
- Color maTextColor;
sal_uInt16 nStretchX;
sal_uInt16 nStretchY;
@@ -679,9 +678,6 @@ private:
void SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; }
const Color& GetBackgroundColor() const { return maBackgroundColor; }
- void SetTextColor( const Color& rColor ) { maTextColor = rColor; }
- const Color& GetTextColor() const { return maTextColor; }
-
long CalcVertLineSpacing(Point& rStartPos) const;
Color GetAutoColor() const;
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0d1d3b399f93..6b4b8da61b2e 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -124,7 +124,6 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
eDefLanguage = LANGUAGE_DONTKNOW;
maBackgroundColor = COL_AUTO;
- maTextColor = COL_AUTO;
nAsianCompressionMode = CharCompressType::NONE;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 0cdee12d70ae..ec3e10cf1290 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4418,9 +4418,7 @@ Reference < i18n::XExtendedInputSequenceChecker > const & ImpEditEngine::ImplGet
Color ImpEditEngine::GetAutoColor() const
{
- Color aColor = GetTextColor();
- if ( aColor == COL_AUTO )
- aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
+ Color aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
if ( GetBackgroundColor() != COL_AUTO )
{
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index dfb39a0b8e94..f585ce8b5796 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -216,8 +216,6 @@ public:
void SetBackgroundColor( const Color& rColor );
Color const & GetBackgroundColor() const;
- void SetTextColor( const Color& rColor );
- Color const & GetTextColor() const;
Color GetAutoColor() const;
void EnableAutoColor( bool b );
void ForceAutoColor( bool b );
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index ec4b016f12b9..2e2c7fab4211 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -215,7 +215,7 @@ public:
void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
- void UpdateEditEngineDefaultFonts();
+ void UpdateEditEngineDefaultFonts(const Color& aTextColor);
};
#endif
diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 858360b32e87..45d130b0c658 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -61,6 +61,7 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper
DECL_LINK(ModifyTimerHdl, Timer *, void);
DECL_LINK(CursorMoveTimerHdl, Timer *, void);
+ virtual void ApplySettings(vcl::RenderContext&) override;
virtual void DataChanged( const DataChangedEvent& ) override;
virtual void Resize() override;
virtual void MouseMove(const MouseEvent &rEvt) override;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 965702e1d5a4..bec09afd3163 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -275,7 +275,7 @@ void SmDocShell::ArrangeFormula()
maAccText.clear();
}
-void SmDocShell::UpdateEditEngineDefaultFonts()
+void SmDocShell::UpdateEditEngineDefaultFonts(const Color& aTextColor)
{
assert(mpEditEngineItemPool);
if (!mpEditEngineItemPool)
@@ -310,6 +310,7 @@ void SmDocShell::UpdateEditEngineDefaultFonts()
rFntDta.nFallbackLang : rFntDta.nLang;
vcl::Font aFont = OutputDevice::GetDefaultFont(
rFntDta.nFontType, nLang, GetDefaultFontFlags::OnlyOne );
+ aFont.SetColor(aTextColor);
mpEditEngineItemPool->SetPoolDefaultItem(
SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(),
@@ -338,7 +339,8 @@ EditEngine& SmDocShell::GetEditEngine()
mpEditEngineItemPool = EditEngine::CreatePool();
- UpdateEditEngineDefaultFonts();
+ const StyleSettings& rStyleSettings = Application::GetDefaultDevice()->GetSettings().GetStyleSettings();
+ UpdateEditEngineDefaultFonts(rStyleSettings.GetFieldTextColor());
mpEditEngine.reset( new EditEngine( mpEditEngineItemPool ) );
@@ -348,8 +350,6 @@ EditEngine& SmDocShell::GetEditEngine()
mpEditEngine->SetDefTab( sal_uInt16(
Application::GetDefaultDevice()->GetTextWidth("XXXX")) );
- const StyleSettings& rStyleSettings = Application::GetDefaultDevice()->GetSettings().GetStyleSettings();
- mpEditEngine->SetTextColor(rStyleSettings.GetFieldTextColor());
mpEditEngine->SetBackgroundColor(rStyleSettings.GetFieldColor());
mpEditEngine->SetControlWord(
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 76c10fe6536d..643ef04a1960 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -188,6 +188,12 @@ EditEngine * SmEditWindow::GetEditEngine()
return pEditEng;
}
+void SmEditWindow::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
+}
+
void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
@@ -208,11 +214,9 @@ void SmEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
//!
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- pDoc->UpdateEditEngineDefaultFonts();
-
- pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX")));
- pEditEngine->SetTextColor(rStyleSettings.GetFieldTextColor());
+ pDoc->UpdateEditEngineDefaultFonts(rStyleSettings.GetFieldTextColor());
pEditEngine->SetBackgroundColor(rStyleSettings.GetFieldColor());
+ pEditEngine->SetDefTab(sal_uInt16(GetTextWidth("XXXX")));
// forces new settings to be used
// unfortunately this resets the whole edit engine