LibreOffice Module chart2 (master) 1
Wall.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
20#include "Wall.hxx"
22#include <FillProperties.hxx>
24#include <PropertyHelper.hxx>
26#include <com/sun/star/drawing/LineStyle.hpp>
27
28#include <vector>
29#include <algorithm>
30
31using namespace ::com::sun::star;
32
33using ::com::sun::star::beans::Property;
34
35namespace
36{
37
38::cppu::OPropertyArrayHelper& StaticWallInfoHelper()
39{
40 static ::cppu::OPropertyArrayHelper aPropHelper = []()
41 {
42 std::vector< css::beans::Property > aProperties;
46
47 std::sort( aProperties.begin(), aProperties.end(),
49
50 return comphelper::containerToSequence( aProperties );
51 }();
52 return aPropHelper;
53};
54
55} // anonymous namespace
56
57namespace chart
58{
59
61 m_xModifyEventForwarder( new ModifyEventForwarder() )
62{}
63
64Wall::Wall( const Wall & rOther ) :
65 impl::Wall_Base(rOther),
66 ::property::OPropertySet( rOther ),
67 m_xModifyEventForwarder( new ModifyEventForwarder() )
68{}
69
71{}
72
73// ____ XTypeProvider ____
75{
76 return ::comphelper::concatSequences(
77 impl::Wall_Base::getTypes(),
79}
80
81// ____ XCloneable ____
83{
84 return uno::Reference< util::XCloneable >( new Wall( *this ));
85}
86
87// ____ OPropertySet ____
88void Wall::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const
89{
90 static ::chart::tPropertyValueMap aStaticDefaults = []()
91 {
95
96 // override other defaults
98 return aTmp;
99 }();
100 tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( nHandle ) );
101 if( aFound == aStaticDefaults.end() )
102 rAny.clear();
103 else
104 rAny = (*aFound).second;
105}
106
108{
109 return StaticWallInfoHelper();
110}
111
112// ____ XPropertySet ____
114{
115 static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
116 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticWallInfoHelper() ) );
117 return xPropertySetInfo;
118}
119
120// ____ XModifyBroadcaster ____
122{
123 m_xModifyEventForwarder->addModifyListener( aListener );
124}
125
127{
128 m_xModifyEventForwarder->removeModifyListener( aListener );
129}
130
131// ____ XModifyListener ____
132void SAL_CALL Wall::modified( const lang::EventObject& aEvent )
133{
134 m_xModifyEventForwarder->modified( aEvent );
135}
136
137// ____ XEventListener (base of XModifyListener) ____
138void SAL_CALL Wall::disposing( const lang::EventObject& /* Source */ )
139{
140 // nothing
141}
142
143// ____ OPropertySet ____
145{
146 m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
147}
148
149using impl::Wall_Base;
150
152
153} // namespace chart
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
AnyEventRef aEvent
This helper class serves as forwarder of modify events.
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: Wall.cxx:121
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
The InfoHelper table contains all property names and types of this object.
Definition: Wall.cxx:107
virtual ~Wall() override
Definition: Wall.cxx:70
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: Wall.cxx:82
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: Wall.cxx:132
rtl::Reference< ModifyEventForwarder > m_xModifyEventForwarder
Definition: Wall.hxx:90
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: Wall.cxx:126
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: Wall.cxx:74
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Wall.cxx:113
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const override
implement this method to provide default values for all properties supporting defaults.
Definition: Wall.cxx:88
virtual void firePropertyChangeEvent() override
implement this method in derived classes to get called when properties change.
Definition: Wall.cxx:144
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
void SAL_CALL disposing()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap(::chart::tPropertyValueMap &rOutMap)
OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
::cppu::WeakImplHelper< css::util::XCloneable, css::util::XModifyBroadcaster, css::util::XModifyListener > Wall_Base
Definition: Wall.hxx:37
std::unordered_map< tPropertyValueMapKey, css::uno::Any > tPropertyValueMap
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
sal_Int32 nHandle