summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-05-13 21:57:15 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-05-15 19:37:18 +0200
commit78523a2d03c95843c417c869bc90e14cfd267bcb (patch)
tree02b6b20b90d4d2b7c2b2be30ad2a23f5c4cbd9c5 /starmath
parent48e44b367a6fde947963de0d896e5d276a7f231e (diff)
SM handle background theme changes
Replaces ApplyColorConfigValues with standard ApplySettings. I also opted to use COL_WHITE for the elements list, as the highlight color is also hard-coded to some light gray. Change-Id: I8be9d5897bf1dda4078b91d4df34a3339ac6cf31 Reviewed-on: https://gerrit.libreoffice.org/72314 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/ElementsDockingWindow.hxx1
-rw-r--r--starmath/inc/smmod.hxx2
-rw-r--r--starmath/inc/view.hxx3
-rw-r--r--starmath/source/ElementsDockingWindow.cxx30
-rw-r--r--starmath/source/smmod.cxx29
-rw-r--r--starmath/source/view.cxx16
6 files changed, 36 insertions, 45 deletions
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 133c480d7100..fe712401f773 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -72,6 +72,7 @@ class SmElementsControl : public Control
static const std::pair<const char*, const char*> aFormats[];
static const std::pair<const char*, const char*> aOthers[];
+ virtual void ApplySettings(vcl::RenderContext&) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
virtual void MouseMove(const MouseEvent& rMEvt) override;
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index fc97d5392912..297f8a972e50 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -70,8 +70,6 @@ class SmModule : public SfxModule, public utl::ConfigurationListener
std::unique_ptr<SvtSysLocale> mpSysLocale;
VclPtr<VirtualDevice> mpVirtualDev;
- static void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
-
public:
SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + SfxInterfaceId(0))
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 2b1692e8d9df..fb27546c456f 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -61,6 +61,7 @@ public:
virtual void dispose() override;
// Window
+ virtual void ApplySettings(vcl::RenderContext&) override;
virtual void MouseButtonDown(const MouseEvent &rMEvt) override;
virtual void MouseMove(const MouseEvent &rMEvt) override;
virtual void GetFocus() override;
@@ -88,8 +89,6 @@ public:
using ScrollableWindow::SetTotalSize;
void SetTotalSize();
- void ApplyColorConfigValues(const svtools::ColorConfig &rColorCfg);
-
// for Accessibility
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 95df76c4ec63..ab0ad7dd689e 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -30,14 +30,15 @@
#include "uiobject.hxx"
#include <strings.hxx>
-#include <svl/stritem.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/sfxmodelfactory.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/colorcfg.hxx>
#include <vcl/event.hxx>
#include <vcl/help.hxx>
#include <vcl/settings.hxx>
-#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
+#include <vcl/uitest/logger.hxx>
SmElement::SmElement(std::unique_ptr<SmNode>&& pNode, const OUString& aText, const OUString& aHelpText) :
mpNode(std::move(pNode)),
@@ -348,21 +349,21 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
}
}
- if (mpCurrentElement == element && pContext)
- {
- pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
- pContext->SetFillColor(Color(230, 230, 230));
- pContext->SetLineColor(Color(230, 230, 230));
-
- pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
- pContext->Pop();
- }
-
element->mBoxLocation = Point(x,y);
element->mBoxSize = Size(boxX, boxY);
if (pContext)
{
+ if (mpCurrentElement == element)
+ {
+ pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ pContext->SetFillColor(Color(230, 230, 230));
+ pContext->SetLineColor(Color(230, 230, 230));
+
+ pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2)));
+ pContext->Pop();
+ }
+
Size aSizePixel = LogicToPixel(Size(element->getNode()->GetWidth(),
element->getNode()->GetHeight()));
Point location(x + ((boxX - aSizePixel.Width()) / 2),
@@ -396,6 +397,11 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
}
}
+void SmElementsControl::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+ rRenderContext.SetBackground(COL_WHITE);
+}
+
void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
rRenderContext.Push();
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 041190181abf..cfa7048d23a0 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -133,35 +133,28 @@ SmModule::~SmModule()
mpVirtualDev.disposeAndClear();
}
-void SmModule::ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg )
-{
- //invalidate all graphic and edit windows
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
- {
- SmViewShell *pSmView = static_cast<SmViewShell *>(pViewShell);
- pSmView->GetGraphicWindow().ApplyColorConfigValues( rColorCfg );
- }
- pViewShell = SfxViewShell::GetNext( *pViewShell );
- }
-}
-
svtools::ColorConfig & SmModule::GetColorConfig()
{
if(!mpColorConfig)
{
mpColorConfig.reset(new svtools::ColorConfig);
- ApplyColorConfigValues( *mpColorConfig );
mpColorConfig->AddListener(this);
}
return *mpColorConfig;
}
-void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints )
+void SmModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, ConfigurationHints)
{
- ApplyColorConfigValues(*mpColorConfig);
+ if (pBrdCst == mpColorConfig.get())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
+ pViewShell->GetWindow()->Invalidate();
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
}
SmMathConfig * SmModule::GetConfig()
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index cdc8b0b78862..96874023c9dc 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -135,15 +135,6 @@ void SmGraphicWindow::StateChanged(StateChangedType eType)
ScrollableWindow::StateChanged(eType);
}
-
-void SmGraphicWindow::ApplyColorConfigValues(const svtools::ColorConfig &rColorCfg)
-{
- // Note: SetTextColor not necessary since the nodes that
- // get painted have the color information.
- SetBackground(rColorCfg.GetColorValue(svtools::DOCCOLOR).nColor);
-}
-
-
void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
{
ScrollableWindow::MouseButtonDown(rMEvt);
@@ -368,10 +359,13 @@ const SmNode * SmGraphicWindow::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol)
return pNode;
}
-void SmGraphicWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+void SmGraphicWindow::ApplySettings(vcl::RenderContext& rRenderContext)
{
- ApplyColorConfigValues(SM_MOD()->GetColorConfig());
+ rRenderContext.SetBackground(SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor);
+}
+void SmGraphicWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
SmDocShell& rDoc = *pViewShell->GetDoc();
Point aPoint;