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(Window* _pParent ,const OUString& _sColorEntry)
30 : : Window(_pParent)
31 : ,m_sColorEntry(_sColorEntry)
32 : ,m_nColor(COL_LIGHTBLUE)
33 : ,m_bCollapsed(sal_False)
34 0 : ,m_bMarked(sal_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 : if (rHint.ISA(SfxSimpleHint)
49 0 : && (static_cast< SfxSimpleHint const & >(rHint).GetId()
50 : == SFX_HINT_COLORS_CHANGED))
51 : {
52 0 : m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
53 0 : m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
54 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
55 : }
56 0 : }
57 :
58 0 : void OColorListener::DataChanged( const DataChangedEvent& rDCEvt )
59 : {
60 0 : Window::DataChanged( rDCEvt );
61 :
62 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
63 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
64 : {
65 0 : ImplInitSettings();
66 0 : Invalidate();
67 : }
68 0 : }
69 :
70 0 : void OColorListener::setCollapsed(sal_Bool _bCollapsed)
71 : {
72 0 : if ( m_bCollapsed != _bCollapsed )
73 : {
74 0 : m_bCollapsed = _bCollapsed;
75 0 : if ( m_aCollapsedLink.IsSet() )
76 0 : m_aCollapsedLink.Call(this);
77 : }
78 0 : }
79 :
80 0 : void OColorListener::setMarked(sal_Bool _bMark)
81 : {
82 0 : if ( m_bMarked != _bMark)
83 : {
84 0 : m_bMarked = _bMark;
85 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
86 : }
87 0 : }
88 :
89 : }
90 :
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|