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 <vcl/settings.hxx>
22 #include <vcl/event.hxx>
23 
24 #include <strings.hxx>
25 
26 
27 namespace rptui
28 {
29 
30 OColorListener::OColorListener(vcl::Window* _pParent ,const OUString& _sColorEntry)
31 : Window(_pParent)
32 ,m_sColorEntry(_sColorEntry)
33 ,m_nColor(COL_LIGHTBLUE)
34 ,m_bCollapsed(false)
35 ,m_bMarked(false)
36 {
40 }
41 
43 {
44  disposeOnce();
45 }
46 
48 {
51 }
52 
53 void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
54 {
55  if (rHint.GetId() == SfxHintId::ColorsChanged)
56  {
59  Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
60  }
61 }
62 
64 {
65  Window::DataChanged( rDCEvt );
66 
67  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
68  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
69  {
71  Invalidate();
72  }
73 }
74 
75 void OColorListener::setCollapsed(bool _bCollapsed)
76 {
77  if ( m_bCollapsed != _bCollapsed )
78  {
79  m_bCollapsed = _bCollapsed;
80  m_aCollapsedLink.Call(*this);
81  }
82 }
83 
84 void OColorListener::setMarked(bool _bMark)
85 {
86  if ( m_bMarked != _bMark)
87  {
88  m_bMarked = _bMark;
89  Invalidate(InvalidateFlags::NoChildren|InvalidateFlags::NoErase);
90  }
91 }
92 
93 }
94 
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
DataChangedEventType GetType() const
virtual void dispose() override
void setMarked(bool _bMark)
set the marker as marked or not marked
SfxHintId GetId() const
Link< OColorListener &, void > m_aCollapsedLink
AllSettingsFlags GetFlags() const
svtools::ExtendedColorConfig m_aExtendedColorConfig
#define CFG_REPORTDESIGNER
Definition: strings.hxx:251
virtual void ImplInitSettings()=0
virtual ~OColorListener() override
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
virtual void setCollapsed(bool _bCollapsed)
collapse or expand
OColorListener(const OColorListener &)=delete
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void Notify(SfxBroadcaster &rBc, SfxHint const &rHint) override
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
ExtendedColorConfigValue GetColorValue(const OUString &_sComponentName, const OUString &_sName) const
virtual void dispose() override
svtools::ColorConfig m_aColorConfig