/src/libreoffice/chart2/source/model/main/Wall.cxx
Line | Count | Source |
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 | | |
20 | | #include "Wall.hxx" |
21 | | #include <LinePropertiesHelper.hxx> |
22 | | #include <FillProperties.hxx> |
23 | | #include <UserDefinedProperties.hxx> |
24 | | #include <PropertyHelper.hxx> |
25 | | #include <ModifyListenerHelper.hxx> |
26 | | #include <com/sun/star/drawing/LineStyle.hpp> |
27 | | |
28 | | #include <vector> |
29 | | #include <algorithm> |
30 | | |
31 | | using namespace ::com::sun::star; |
32 | | |
33 | | using ::com::sun::star::beans::Property; |
34 | | |
35 | | namespace |
36 | | { |
37 | | |
38 | | ::cppu::OPropertyArrayHelper& StaticWallInfoHelper() |
39 | 0 | { |
40 | 0 | static ::cppu::OPropertyArrayHelper aPropHelper = []() |
41 | 0 | { |
42 | 0 | std::vector< css::beans::Property > aProperties; |
43 | 0 | ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); |
44 | 0 | ::chart::FillProperties::AddPropertiesToVector( aProperties ); |
45 | 0 | ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); |
46 | |
|
47 | 0 | std::sort( aProperties.begin(), aProperties.end(), |
48 | 0 | ::chart::PropertyNameLess() ); |
49 | |
|
50 | 0 | return comphelper::containerToSequence( aProperties ); |
51 | 0 | }(); |
52 | 0 | return aPropHelper; |
53 | 0 | }; |
54 | | |
55 | | } // anonymous namespace |
56 | | |
57 | | namespace chart |
58 | | { |
59 | | |
60 | | Wall::Wall() : |
61 | 0 | m_xModifyEventForwarder( new ModifyEventForwarder() ) |
62 | 0 | {} |
63 | | |
64 | | Wall::Wall( const Wall & rOther ) : |
65 | 0 | impl::Wall_Base(rOther), |
66 | 0 | ::property::OPropertySet( rOther ), |
67 | 0 | m_xModifyEventForwarder( new ModifyEventForwarder() ) |
68 | 0 | {} |
69 | | |
70 | | Wall::~Wall() |
71 | 0 | {} |
72 | | |
73 | | // ____ XTypeProvider ____ |
74 | | uno::Sequence< css::uno::Type > SAL_CALL Wall::getTypes() |
75 | 0 | { |
76 | 0 | return ::comphelper::concatSequences( |
77 | 0 | impl::Wall_Base::getTypes(), |
78 | 0 | ::property::OPropertySet::getTypes()); |
79 | 0 | } |
80 | | |
81 | | // ____ XCloneable ____ |
82 | | uno::Reference< util::XCloneable > SAL_CALL Wall::createClone() |
83 | 0 | { |
84 | 0 | return uno::Reference< util::XCloneable >( new Wall( *this )); |
85 | 0 | } |
86 | | |
87 | | // ____ OPropertySet ____ |
88 | | void Wall::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const |
89 | 0 | { |
90 | 0 | static ::chart::tPropertyValueMap aStaticDefaults = []() |
91 | 0 | { |
92 | 0 | ::chart::tPropertyValueMap aTmp; |
93 | 0 | ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp ); |
94 | 0 | ::chart::FillProperties::AddDefaultsToMap( aTmp ); |
95 | | |
96 | | // override other defaults |
97 | 0 | ::chart::PropertyHelper::setPropertyValue( aTmp, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); |
98 | 0 | return aTmp; |
99 | 0 | }(); |
100 | 0 | tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) ); |
101 | 0 | if( aFound == aStaticDefaults.end() ) |
102 | 0 | rAny.clear(); |
103 | 0 | else |
104 | 0 | rAny = (*aFound).second; |
105 | 0 | } |
106 | | |
107 | | ::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper() |
108 | 0 | { |
109 | 0 | return StaticWallInfoHelper(); |
110 | 0 | } |
111 | | |
112 | | // ____ XPropertySet ____ |
113 | | uno::Reference< beans::XPropertySetInfo > SAL_CALL Wall::getPropertySetInfo() |
114 | 0 | { |
115 | 0 | static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( |
116 | 0 | ::cppu::OPropertySetHelper::createPropertySetInfo(StaticWallInfoHelper() ) ); |
117 | 0 | return xPropertySetInfo; |
118 | 0 | } |
119 | | |
120 | | // ____ XModifyBroadcaster ____ |
121 | | void SAL_CALL Wall::addModifyListener( const uno::Reference< util::XModifyListener >& aListener ) |
122 | 0 | { |
123 | 0 | m_xModifyEventForwarder->addModifyListener( aListener ); |
124 | 0 | } |
125 | | |
126 | | void SAL_CALL Wall::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener ) |
127 | 0 | { |
128 | 0 | m_xModifyEventForwarder->removeModifyListener( aListener ); |
129 | 0 | } |
130 | | |
131 | | // ____ XModifyListener ____ |
132 | | void SAL_CALL Wall::modified( const lang::EventObject& aEvent ) |
133 | 0 | { |
134 | 0 | m_xModifyEventForwarder->modified( aEvent ); |
135 | 0 | } |
136 | | |
137 | | // ____ XEventListener (base of XModifyListener) ____ |
138 | | void SAL_CALL Wall::disposing( const lang::EventObject& /* Source */ ) |
139 | 0 | { |
140 | | // nothing |
141 | 0 | } |
142 | | |
143 | | // ____ OPropertySet ____ |
144 | | void Wall::firePropertyChangeEvent() |
145 | 0 | { |
146 | 0 | m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this ))); |
147 | 0 | } |
148 | | |
149 | | using impl::Wall_Base; |
150 | | |
151 | | IMPLEMENT_FORWARD_XINTERFACE2( Wall, Wall_Base, ::property::OPropertySet ) |
152 | | |
153 | | } // namespace chart |
154 | | |
155 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |