1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
31 using namespace ::com::sun::star
;
33 using ::com::sun::star::beans::Property
;
38 ::cppu::OPropertyArrayHelper
& StaticWallInfoHelper()
40 static ::cppu::OPropertyArrayHelper aPropHelper
= []()
42 std::vector
< css::beans::Property
> aProperties
;
43 ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties
);
44 ::chart::FillProperties::AddPropertiesToVector( aProperties
);
45 ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties
);
47 std::sort( aProperties
.begin(), aProperties
.end(),
48 ::chart::PropertyNameLess() );
50 return comphelper::containerToSequence( aProperties
);
55 } // anonymous namespace
61 m_xModifyEventForwarder( new ModifyEventForwarder() )
64 Wall::Wall( const Wall
& rOther
) :
65 impl::Wall_Base(rOther
),
66 ::property::OPropertySet( rOther
),
67 m_xModifyEventForwarder( new ModifyEventForwarder() )
73 // ____ XTypeProvider ____
74 uno::Sequence
< css::uno::Type
> SAL_CALL
Wall::getTypes()
76 return ::comphelper::concatSequences(
77 impl::Wall_Base::getTypes(),
78 ::property::OPropertySet::getTypes());
81 // ____ XCloneable ____
82 uno::Reference
< util::XCloneable
> SAL_CALL
Wall::createClone()
84 return uno::Reference
< util::XCloneable
>( new Wall( *this ));
87 // ____ OPropertySet ____
88 void Wall::GetDefaultValue( sal_Int32 nHandle
, uno::Any
& rAny
) const
90 static ::chart::tPropertyValueMap aStaticDefaults
= []()
92 ::chart::tPropertyValueMap aTmp
;
93 ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp
);
94 ::chart::FillProperties::AddDefaultsToMap( aTmp
);
96 // override other defaults
97 ::chart::PropertyHelper::setPropertyValue( aTmp
, ::chart::LinePropertiesHelper::PROP_LINE_STYLE
, drawing::LineStyle_NONE
);
100 tPropertyValueMap::const_iterator
aFound( aStaticDefaults
.find( nHandle
) );
101 if( aFound
== aStaticDefaults
.end() )
104 rAny
= (*aFound
).second
;
107 ::cppu::IPropertyArrayHelper
& SAL_CALL
Wall::getInfoHelper()
109 return StaticWallInfoHelper();
112 // ____ XPropertySet ____
113 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
Wall::getPropertySetInfo()
115 static uno::Reference
< beans::XPropertySetInfo
> xPropertySetInfo(
116 ::cppu::OPropertySetHelper::createPropertySetInfo(StaticWallInfoHelper() ) );
117 return xPropertySetInfo
;
120 // ____ XModifyBroadcaster ____
121 void SAL_CALL
Wall::addModifyListener( const uno::Reference
< util::XModifyListener
>& aListener
)
123 m_xModifyEventForwarder
->addModifyListener( aListener
);
126 void SAL_CALL
Wall::removeModifyListener( const uno::Reference
< util::XModifyListener
>& aListener
)
128 m_xModifyEventForwarder
->removeModifyListener( aListener
);
131 // ____ XModifyListener ____
132 void SAL_CALL
Wall::modified( const lang::EventObject
& aEvent
)
134 m_xModifyEventForwarder
->modified( aEvent
);
137 // ____ XEventListener (base of XModifyListener) ____
138 void SAL_CALL
Wall::disposing( const lang::EventObject
& /* Source */ )
143 // ____ OPropertySet ____
144 void Wall::firePropertyChangeEvent()
146 m_xModifyEventForwarder
->modified( lang::EventObject( static_cast< uno::XWeak
* >( this )));
149 using impl::Wall_Base
;
151 IMPLEMENT_FORWARD_XINTERFACE2( Wall
, Wall_Base
, ::property::OPropertySet
)
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */