Kaydet (Commit) 78523a2d authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst 48e44b36
......@@ -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;
......
......@@ -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))
......
......@@ -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;
......
......@@ -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();
......
......@@ -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()
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment