LibreOffice Module reportdesign (master) 1
ColorListener.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#include <ColorListener.hxx>
20#include <svl/hint.hxx>
21#include <utility>
22#include <vcl/settings.hxx>
23#include <vcl/event.hxx>
24
25#include <strings.hxx>
26
27
28namespace rptui
29{
30
31OColorListener::OColorListener(vcl::Window* _pParent ,OUString _sColorEntry)
32: Window(_pParent)
33,m_sColorEntry(std::move(_sColorEntry))
34,m_nColor(COL_LIGHTBLUE)
35,m_bCollapsed(false)
36,m_bMarked(false)
37{
40 m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
41}
42
44{
46}
47
49{
52}
53
54void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
55{
56 if (rHint.GetId() == SfxHintId::ColorsChanged)
57 {
59 m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
60 Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
61 }
62}
63
65{
66 Window::DataChanged( rDCEvt );
67
68 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
69 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
70 {
72 Invalidate();
73 }
74}
75
76void OColorListener::setCollapsed(bool _bCollapsed)
77{
78 if ( m_bCollapsed != _bCollapsed )
79 {
80 m_bCollapsed = _bCollapsed;
81 m_aCollapsedLink.Call(*this);
82 }
83}
84
86{
87 if ( m_bMarked != _bMark)
88 {
89 m_bMarked = _bMark;
90 Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
91 }
92}
93
94}
95
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
SfxHintId GetId() const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void dispose() override
virtual void setCollapsed(bool _bCollapsed)
collapse or expand
Link< OColorListener &, void > m_aCollapsedLink
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual ~OColorListener() override
void setMarked(bool _bMark)
set the marker as marked or not marked
svtools::ExtendedColorConfig m_aExtendedColorConfig
virtual void Notify(SfxBroadcaster &rBc, SfxHint const &rHint) override
OColorListener(const OColorListener &)=delete
virtual void ImplInitSettings()=0
svtools::ColorConfig m_aColorConfig
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
ExtendedColorConfigValue GetColorValue(const OUString &_sComponentName, const OUString &_sName) const
virtual void dispose() override
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
constexpr OUStringLiteral CFG_REPORTDESIGNER
Definition: strings.hxx:244