Line data Source code
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/smplhint.hxx>
21 : #include <vcl/settings.hxx>
22 :
23 : #include "uistrings.hrc"
24 :
25 :
26 : namespace rptui
27 : {
28 :
29 0 : OColorListener::OColorListener(vcl::Window* _pParent ,const OUString& _sColorEntry)
30 : : Window(_pParent)
31 : ,m_sColorEntry(_sColorEntry)
32 : ,m_nColor(COL_LIGHTBLUE)
33 : ,m_bCollapsed(false)
34 0 : ,m_bMarked(false)
35 : {
36 0 : StartListening(m_aExtendedColorConfig);
37 0 : m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
38 0 : m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
39 0 : }
40 :
41 0 : OColorListener::~OColorListener()
42 : {
43 0 : EndListening(m_aExtendedColorConfig);
44 0 : }
45 :
46 0 : void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
47 : {
48 0 : const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
49 0 : if (pSimpleHint && pSimpleHint->GetId() == SFX_HINT_COLORS_CHANGED)
50 : {
51 0 : m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
52 0 : m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
53 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
54 : }
55 0 : }
56 :
57 0 : void OColorListener::DataChanged( const DataChangedEvent& rDCEvt )
58 : {
59 0 : Window::DataChanged( rDCEvt );
60 :
61 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
62 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
63 : {
64 0 : ImplInitSettings();
65 0 : Invalidate();
66 : }
67 0 : }
68 :
69 0 : void OColorListener::setCollapsed(bool _bCollapsed)
70 : {
71 0 : if ( m_bCollapsed != _bCollapsed )
72 : {
73 0 : m_bCollapsed = _bCollapsed;
74 0 : if ( m_aCollapsedLink.IsSet() )
75 0 : m_aCollapsedLink.Call(this);
76 : }
77 0 : }
78 :
79 0 : void OColorListener::setMarked(bool _bMark)
80 : {
81 0 : if ( m_bMarked != _bMark)
82 : {
83 0 : m_bMarked = _bMark;
84 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
85 : }
86 0 : }
87 :
88 6 : }
89 :
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|