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 "uistrings.hrc"
22 :
23 : //=====================================================================
24 : namespace rptui
25 : {
26 : //=====================================================================
27 : DBG_NAME( rpt_OColorListener )
28 0 : OColorListener::OColorListener(Window* _pParent ,const ::rtl::OUString& _sColorEntry)
29 : : Window(_pParent)
30 : ,m_sColorEntry(_sColorEntry)
31 : ,m_nColor(COL_LIGHTBLUE)
32 : ,m_bCollapsed(sal_False)
33 0 : ,m_bMarked(sal_False)
34 : {
35 : DBG_CTOR( rpt_OColorListener,NULL);
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 : DBG_DTOR( rpt_OColorListener,NULL);
44 0 : EndListening(m_aExtendedColorConfig);
45 0 : }
46 : // -----------------------------------------------------------------------
47 0 : void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint)
48 : {
49 0 : if (rHint.ISA(SfxSimpleHint)
50 0 : && (static_cast< SfxSimpleHint const & >(rHint).GetId()
51 : == SFX_HINT_COLORS_CHANGED))
52 : {
53 0 : m_nColor = m_aExtendedColorConfig.GetColorValue(CFG_REPORTDESIGNER,m_sColorEntry).getColor();
54 0 : m_nTextBoundaries = m_aColorConfig.GetColorValue(::svtools::DOCBOUNDARIES).nColor;
55 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
56 : }
57 0 : }
58 : //-----------------------------------------------------------------------------
59 0 : void OColorListener::DataChanged( const DataChangedEvent& rDCEvt )
60 : {
61 0 : Window::DataChanged( rDCEvt );
62 :
63 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
64 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
65 : {
66 0 : ImplInitSettings();
67 0 : Invalidate();
68 : }
69 0 : }
70 : // -----------------------------------------------------------------------------
71 0 : void OColorListener::setCollapsed(sal_Bool _bCollapsed)
72 : {
73 0 : if ( m_bCollapsed != _bCollapsed )
74 : {
75 0 : m_bCollapsed = _bCollapsed;
76 0 : if ( m_aCollapsedLink.IsSet() )
77 0 : m_aCollapsedLink.Call(this);
78 : }
79 0 : }
80 : // -----------------------------------------------------------------------------
81 0 : void OColorListener::setMarked(sal_Bool _bMark)
82 : {
83 0 : if ( m_bMarked != _bMark)
84 : {
85 0 : m_bMarked = _bMark;
86 0 : Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_NOERASE);
87 : }
88 0 : }
89 : // =======================================================================
90 : }
91 : // =======================================================================
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|