xref: /trunk/main/chart2/source/model/main/Diagram.cxx (revision 0e620359)
1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5cde9e8dcSAndrew Rist  * distributed with this work for additional information
6cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cde9e8dcSAndrew Rist  *
11cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cde9e8dcSAndrew Rist  *
13cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist  * under the License.
19cde9e8dcSAndrew Rist  *
20cde9e8dcSAndrew Rist  *************************************************************/
21cde9e8dcSAndrew Rist 
22cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "Diagram.hxx"
27cdf0e10cSrcweir #include "macros.hxx"
28cdf0e10cSrcweir #include "PropertyHelper.hxx"
29cdf0e10cSrcweir #include "Wall.hxx"
30cdf0e10cSrcweir #include "UserDefinedProperties.hxx"
31cdf0e10cSrcweir #include "ConfigColorScheme.hxx"
32cdf0e10cSrcweir #include "DiagramHelper.hxx"
33cdf0e10cSrcweir #include "ContainerHelper.hxx"
34cdf0e10cSrcweir #include "ThreeDHelper.hxx"
35cdf0e10cSrcweir #include "CloneHelper.hxx"
36cdf0e10cSrcweir #include "AxisHelper.hxx"
37cdf0e10cSrcweir #include "SceneProperties.hxx"
38cdf0e10cSrcweir #include "DisposeHelper.hxx"
39cdf0e10cSrcweir #include "BaseGFXHelper.hxx"
40cdf0e10cSrcweir #include <basegfx/numeric/ftools.hxx>
41cdf0e10cSrcweir #include <rtl/instance.hxx>
42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
43cdf0e10cSrcweir #include <com/sun/star/chart2/RelativePosition.hpp>
44cdf0e10cSrcweir #include <com/sun/star/chart2/RelativeSize.hpp>
45cdf0e10cSrcweir #include <com/sun/star/drawing/CameraGeometry.hpp>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix.hpp>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <algorithm>
50cdf0e10cSrcweir #include <iterator>
51cdf0e10cSrcweir #include <functional>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir using namespace ::com::sun::star;
54cdf0e10cSrcweir using namespace ::com::sun::star::beans::PropertyAttribute;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using ::rtl::OUString;
57cdf0e10cSrcweir using ::com::sun::star::beans::Property;
58cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
59cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
60cdf0e10cSrcweir using ::com::sun::star::uno::Any;
61cdf0e10cSrcweir using ::osl::MutexGuard;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // ======================================================================
64cdf0e10cSrcweir 
65cdf0e10cSrcweir namespace
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 
68cdf0e10cSrcweir enum
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     PROP_DIAGRAM_REL_POS,
71cdf0e10cSrcweir     PROP_DIAGRAM_REL_SIZE,
72cdf0e10cSrcweir     PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
73cdf0e10cSrcweir     PROP_DIAGRAM_SORT_BY_X_VALUES,
74cdf0e10cSrcweir     PROP_DIAGRAM_CONNECT_BARS,
75cdf0e10cSrcweir     PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
76cdf0e10cSrcweir     PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
77cdf0e10cSrcweir     PROP_DIAGRAM_STARTING_ANGLE,
78cdf0e10cSrcweir     PROP_DIAGRAM_RIGHT_ANGLED_AXES,
79cdf0e10cSrcweir     PROP_DIAGRAM_PERSPECTIVE,
80cdf0e10cSrcweir     PROP_DIAGRAM_ROTATION_HORIZONTAL,
81cdf0e10cSrcweir     PROP_DIAGRAM_ROTATION_VERTICAL,
82*0e620359SArmin Le Grand     PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
83*0e620359SArmin Le Grand     PROP_DIAGRAM_3DRELATIVEHEIGHT
84cdf0e10cSrcweir };
85cdf0e10cSrcweir 
lcl_AddPropertiesToVector(::std::vector<Property> & rOutProperties)86cdf0e10cSrcweir void lcl_AddPropertiesToVector(
87cdf0e10cSrcweir     ::std::vector< Property > & rOutProperties )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     rOutProperties.push_back(
90cdf0e10cSrcweir         Property( C2U( "RelativePosition" ),
91cdf0e10cSrcweir                   PROP_DIAGRAM_REL_POS,
92cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const chart2::RelativePosition * >(0)),
93cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
94cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     rOutProperties.push_back(
97cdf0e10cSrcweir         Property( C2U( "RelativeSize" ),
98cdf0e10cSrcweir                   PROP_DIAGRAM_REL_SIZE,
99cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const chart2::RelativeSize * >(0)),
100cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
101cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     rOutProperties.push_back(
104cdf0e10cSrcweir         Property( C2U( "PosSizeExcludeAxes" ),
105cdf0e10cSrcweir                   PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS,
106cdf0e10cSrcweir                   ::getBooleanCppuType(),
107cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
108cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     rOutProperties.push_back(
111cdf0e10cSrcweir         Property( C2U( "SortByXValues" ),
112cdf0e10cSrcweir                   PROP_DIAGRAM_SORT_BY_X_VALUES,
113cdf0e10cSrcweir                   ::getBooleanCppuType(),
114cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
115cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     rOutProperties.push_back(
118cdf0e10cSrcweir         Property( C2U("ConnectBars"),
119cdf0e10cSrcweir                   PROP_DIAGRAM_CONNECT_BARS,
120cdf0e10cSrcweir                   ::getBooleanCppuType(),
121cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
122cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     rOutProperties.push_back(
125cdf0e10cSrcweir         Property( C2U("GroupBarsPerAxis"),
126cdf0e10cSrcweir                   PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
127cdf0e10cSrcweir                   ::getBooleanCppuType(),
128cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
129cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     rOutProperties.push_back(
132cdf0e10cSrcweir         Property( C2U("IncludeHiddenCells"),
133cdf0e10cSrcweir                   PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
134cdf0e10cSrcweir                   ::getBooleanCppuType(),
135cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
136cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     rOutProperties.push_back(
139cdf0e10cSrcweir         Property( C2U( "StartingAngle" ),
140cdf0e10cSrcweir                   PROP_DIAGRAM_STARTING_ANGLE,
141cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
142cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
143cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     rOutProperties.push_back(
146cdf0e10cSrcweir         Property( C2U("RightAngledAxes"),
147cdf0e10cSrcweir                   PROP_DIAGRAM_RIGHT_ANGLED_AXES,
148cdf0e10cSrcweir                   ::getBooleanCppuType(),
149cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
150cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
151cdf0e10cSrcweir 
152cdf0e10cSrcweir     rOutProperties.push_back(
153cdf0e10cSrcweir         Property( C2U("Perspective"),
154cdf0e10cSrcweir                   PROP_DIAGRAM_PERSPECTIVE,
155cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
156cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     rOutProperties.push_back(
159cdf0e10cSrcweir         Property( C2U("RotationHorizontal"),
160cdf0e10cSrcweir                   PROP_DIAGRAM_ROTATION_HORIZONTAL,
161cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
162cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     rOutProperties.push_back(
165cdf0e10cSrcweir         Property( C2U("RotationVertical"),
166cdf0e10cSrcweir                   PROP_DIAGRAM_ROTATION_VERTICAL,
167cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
168cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     rOutProperties.push_back(
171cdf0e10cSrcweir         Property( C2U( "MissingValueTreatment" ),
172cdf0e10cSrcweir                   PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
173cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
174cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
175cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
176*0e620359SArmin Le Grand    rOutProperties.push_back(
177*0e620359SArmin Le Grand    Property( C2U("3DRelativeHeight"),
178*0e620359SArmin Le Grand                   PROP_DIAGRAM_3DRELATIVEHEIGHT,
179*0e620359SArmin Le Grand                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
180*0e620359SArmin Le Grand                   beans::PropertyAttribute::MAYBEVOID ));
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir struct StaticDiagramDefaults_Initializer
184cdf0e10cSrcweir {
operator ()__anon1402b9cb0111::StaticDiagramDefaults_Initializer185cdf0e10cSrcweir     ::chart::tPropertyValueMap* operator()()
186cdf0e10cSrcweir     {
187cdf0e10cSrcweir         static ::chart::tPropertyValueMap aStaticDefaults;
188cdf0e10cSrcweir         lcl_AddDefaultsToMap( aStaticDefaults );
189cdf0e10cSrcweir         return &aStaticDefaults;
190cdf0e10cSrcweir     }
191cdf0e10cSrcweir private:
lcl_AddDefaultsToMap__anon1402b9cb0111::StaticDiagramDefaults_Initializer192cdf0e10cSrcweir     void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
193cdf0e10cSrcweir     {
194cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
195cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
196cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
197cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
198cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
199cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
200cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
201*0e620359SArmin Le Grand         ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
202*0e620359SArmin Le Grand 		 ::chart::SceneProperties::AddDefaultsToMap( rOutMap );
203cdf0e10cSrcweir     }
204cdf0e10cSrcweir };
205cdf0e10cSrcweir 
206cdf0e10cSrcweir struct StaticDiagramDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticDiagramDefaults_Initializer >
207cdf0e10cSrcweir {
208cdf0e10cSrcweir };
209cdf0e10cSrcweir 
210cdf0e10cSrcweir struct StaticDiagramInfoHelper_Initializer
211cdf0e10cSrcweir {
operator ()__anon1402b9cb0111::StaticDiagramInfoHelper_Initializer212cdf0e10cSrcweir     ::cppu::OPropertyArrayHelper* operator()()
213cdf0e10cSrcweir     {
214cdf0e10cSrcweir         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
215cdf0e10cSrcweir         return &aPropHelper;
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir private:
lcl_GetPropertySequence__anon1402b9cb0111::StaticDiagramInfoHelper_Initializer219cdf0e10cSrcweir     Sequence< Property > lcl_GetPropertySequence()
220cdf0e10cSrcweir     {
221cdf0e10cSrcweir         ::std::vector< ::com::sun::star::beans::Property > aProperties;
222cdf0e10cSrcweir         lcl_AddPropertiesToVector( aProperties );
223cdf0e10cSrcweir         ::chart::SceneProperties::AddPropertiesToVector( aProperties );
224cdf0e10cSrcweir         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         ::std::sort( aProperties.begin(), aProperties.end(),
227cdf0e10cSrcweir                      ::chart::PropertyNameLess() );
228cdf0e10cSrcweir 
229cdf0e10cSrcweir         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir };
232cdf0e10cSrcweir 
233cdf0e10cSrcweir struct StaticDiagramInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDiagramInfoHelper_Initializer >
234cdf0e10cSrcweir {
235cdf0e10cSrcweir };
236cdf0e10cSrcweir 
237cdf0e10cSrcweir struct StaticDiagramInfo_Initializer
238cdf0e10cSrcweir {
operator ()__anon1402b9cb0111::StaticDiagramInfo_Initializer239cdf0e10cSrcweir     uno::Reference< beans::XPropertySetInfo >* operator()()
240cdf0e10cSrcweir     {
241cdf0e10cSrcweir         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
242cdf0e10cSrcweir             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDiagramInfoHelper::get() ) );
243cdf0e10cSrcweir         return &xPropertySetInfo;
244cdf0e10cSrcweir     }
245cdf0e10cSrcweir };
246cdf0e10cSrcweir 
247cdf0e10cSrcweir struct StaticDiagramInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDiagramInfo_Initializer >
248cdf0e10cSrcweir {
249cdf0e10cSrcweir };
250cdf0e10cSrcweir 
251cdf0e10cSrcweir /// clones a UNO-sequence of UNO-References
252cdf0e10cSrcweir typedef Reference< chart2::XCoordinateSystem > lcl_tCooSysRef;
253cdf0e10cSrcweir typedef ::std::map< lcl_tCooSysRef, lcl_tCooSysRef >  lcl_tCooSysMapping;
254cdf0e10cSrcweir typedef ::std::vector< lcl_tCooSysRef >               lcl_tCooSysVector;
255cdf0e10cSrcweir 
lcl_CloneCoordinateSystems(const lcl_tCooSysVector & rSource,lcl_tCooSysVector & rDestination)256cdf0e10cSrcweir lcl_tCooSysMapping lcl_CloneCoordinateSystems(
257cdf0e10cSrcweir         const lcl_tCooSysVector & rSource,
258cdf0e10cSrcweir         lcl_tCooSysVector & rDestination )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir     lcl_tCooSysMapping aResult;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     for( lcl_tCooSysVector::const_iterator aIt( rSource.begin());
263cdf0e10cSrcweir          aIt != rSource.end(); ++aIt )
264cdf0e10cSrcweir     {
265cdf0e10cSrcweir         lcl_tCooSysRef xClone;
266cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >
267cdf0e10cSrcweir               xCloneable( *aIt, ::com::sun::star::uno::UNO_QUERY );
268cdf0e10cSrcweir         if( xCloneable.is())
269cdf0e10cSrcweir             xClone.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY );
270cdf0e10cSrcweir 
271cdf0e10cSrcweir         if( xClone.is())
272cdf0e10cSrcweir         {
273cdf0e10cSrcweir             rDestination.push_back( xClone );
274cdf0e10cSrcweir             aResult.insert( lcl_tCooSysMapping::value_type( *aIt, xClone ));
275cdf0e10cSrcweir         }
276cdf0e10cSrcweir         else
277cdf0e10cSrcweir             rDestination.push_back( *aIt );
278cdf0e10cSrcweir     }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     return aResult;
281cdf0e10cSrcweir }
282cdf0e10cSrcweir 
283cdf0e10cSrcweir } // anonymous namespace
284cdf0e10cSrcweir 
285cdf0e10cSrcweir // ======================================================================
286cdf0e10cSrcweir 
287cdf0e10cSrcweir namespace chart
288cdf0e10cSrcweir {
289cdf0e10cSrcweir 
Diagram(uno::Reference<uno::XComponentContext> const & xContext)290cdf0e10cSrcweir Diagram::Diagram( uno::Reference< uno::XComponentContext > const & xContext ) :
291cdf0e10cSrcweir         ::property::OPropertySet( m_aMutex ),
292cdf0e10cSrcweir         m_xContext( xContext ),
293cdf0e10cSrcweir         m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
294cdf0e10cSrcweir {
295cdf0e10cSrcweir     // Set camera position to a default position (that should be set hard, so
296cdf0e10cSrcweir     // that it will be exported.  The property default is a camera looking
297cdf0e10cSrcweir     // straight ono the scene).  These defaults have been acquired from the old
298cdf0e10cSrcweir     // chart implemetation.
299cdf0e10cSrcweir     setFastPropertyValue_NoBroadcast(
300cdf0e10cSrcweir         SceneProperties::PROP_SCENE_CAMERA_GEOMETRY, uno::makeAny(
301cdf0e10cSrcweir             ThreeDHelper::getDefaultCameraGeometry()));
302cdf0e10cSrcweir }
303cdf0e10cSrcweir 
Diagram(const Diagram & rOther)304cdf0e10cSrcweir Diagram::Diagram( const Diagram & rOther ) :
305cdf0e10cSrcweir         MutexContainer(),
306cdf0e10cSrcweir         impl::Diagram_Base(),
307cdf0e10cSrcweir         ::property::OPropertySet( rOther, m_aMutex ),
308cdf0e10cSrcweir     m_xContext( rOther.m_xContext ),
309cdf0e10cSrcweir     m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     lcl_tCooSysMapping aCooSysMapping =
312cdf0e10cSrcweir         lcl_CloneCoordinateSystems( rOther.m_aCoordSystems, m_aCoordSystems );
313cdf0e10cSrcweir     ModifyListenerHelper::addListenerToAllElements( m_aCoordSystems, m_xModifyEventForwarder );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     m_xWall.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xWall ));
316cdf0e10cSrcweir     m_xFloor.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xFloor ));
317cdf0e10cSrcweir     m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle ));
318cdf0e10cSrcweir     m_xLegend.set( CloneHelper::CreateRefClone< Reference< chart2::XLegend > >()( rOther.m_xLegend ));
319cdf0e10cSrcweir 
320cdf0e10cSrcweir     ModifyListenerHelper::addListener( m_xWall, m_xModifyEventForwarder );
321cdf0e10cSrcweir     ModifyListenerHelper::addListener( m_xFloor, m_xModifyEventForwarder );
322cdf0e10cSrcweir     ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
323cdf0e10cSrcweir     ModifyListenerHelper::addListener( m_xLegend, m_xModifyEventForwarder );
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
~Diagram()326cdf0e10cSrcweir Diagram::~Diagram()
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     try
329cdf0e10cSrcweir     {
330cdf0e10cSrcweir         ModifyListenerHelper::removeListenerFromAllElements( m_aCoordSystems, m_xModifyEventForwarder );
331cdf0e10cSrcweir 
332cdf0e10cSrcweir         ModifyListenerHelper::removeListener( m_xWall, m_xModifyEventForwarder );
333cdf0e10cSrcweir         ModifyListenerHelper::removeListener( m_xFloor, m_xModifyEventForwarder );
334cdf0e10cSrcweir         ModifyListenerHelper::removeListener( m_xTitle, m_xModifyEventForwarder );
335cdf0e10cSrcweir         ModifyListenerHelper::removeListener( m_xLegend, m_xModifyEventForwarder );
336cdf0e10cSrcweir     }
337cdf0e10cSrcweir     catch( const uno::Exception & ex )
338cdf0e10cSrcweir     {
339cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
340cdf0e10cSrcweir     }
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir // ____ XDiagram ____
getWall()344cdf0e10cSrcweir uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getWall()
345cdf0e10cSrcweir     throw (uno::RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xRet;
348cdf0e10cSrcweir     bool bAddListener = false;
349cdf0e10cSrcweir     {
350cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
351cdf0e10cSrcweir         if( !m_xWall.is() )
352cdf0e10cSrcweir         {
353cdf0e10cSrcweir             m_xWall.set( new Wall() );
354cdf0e10cSrcweir             bAddListener = true;
355cdf0e10cSrcweir         }
356cdf0e10cSrcweir         xRet =  m_xWall;
357cdf0e10cSrcweir     }
358cdf0e10cSrcweir     if(bAddListener)
359cdf0e10cSrcweir         ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
360cdf0e10cSrcweir     return xRet;
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
getFloor()363cdf0e10cSrcweir uno::Reference< beans::XPropertySet > SAL_CALL Diagram::getFloor()
364cdf0e10cSrcweir     throw (uno::RuntimeException)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xRet;
367cdf0e10cSrcweir     bool bAddListener = false;
368cdf0e10cSrcweir     {
369cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
370cdf0e10cSrcweir         if( !m_xFloor.is() )
371cdf0e10cSrcweir         {
372cdf0e10cSrcweir             m_xFloor.set( new Wall() );
373cdf0e10cSrcweir             bAddListener = true;
374cdf0e10cSrcweir         }
375cdf0e10cSrcweir         xRet = m_xFloor;
376cdf0e10cSrcweir     }
377cdf0e10cSrcweir     if(bAddListener)
378cdf0e10cSrcweir         ModifyListenerHelper::addListener( xRet, m_xModifyEventForwarder );
379cdf0e10cSrcweir     return xRet;
380cdf0e10cSrcweir }
381cdf0e10cSrcweir 
getLegend()382cdf0e10cSrcweir uno::Reference< chart2::XLegend > SAL_CALL Diagram::getLegend()
383cdf0e10cSrcweir     throw (uno::RuntimeException)
384cdf0e10cSrcweir {
385cdf0e10cSrcweir     MutexGuard aGuard( GetMutex() );
386cdf0e10cSrcweir     return m_xLegend;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
setLegend(const uno::Reference<chart2::XLegend> & xNewLegend)389cdf0e10cSrcweir void SAL_CALL Diagram::setLegend( const uno::Reference< chart2::XLegend >& xNewLegend )
390cdf0e10cSrcweir     throw (uno::RuntimeException)
391cdf0e10cSrcweir {
392cdf0e10cSrcweir     Reference< chart2::XLegend > xOldLegend;
393cdf0e10cSrcweir     {
394cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
395cdf0e10cSrcweir         if( m_xLegend == xNewLegend )
396cdf0e10cSrcweir             return;
397cdf0e10cSrcweir         xOldLegend = m_xLegend;
398cdf0e10cSrcweir         m_xLegend = xNewLegend;
399cdf0e10cSrcweir     }
400cdf0e10cSrcweir     if( xOldLegend.is())
401cdf0e10cSrcweir         ModifyListenerHelper::removeListener( xOldLegend, m_xModifyEventForwarder );
402cdf0e10cSrcweir     if( xNewLegend.is())
403cdf0e10cSrcweir         ModifyListenerHelper::addListener( xNewLegend, m_xModifyEventForwarder );
404cdf0e10cSrcweir     fireModifyEvent();
405cdf0e10cSrcweir }
406cdf0e10cSrcweir 
getDefaultColorScheme()407cdf0e10cSrcweir Reference< chart2::XColorScheme > SAL_CALL Diagram::getDefaultColorScheme()
408cdf0e10cSrcweir     throw (uno::RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir     Reference< chart2::XColorScheme > xRet;
411cdf0e10cSrcweir     {
412cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
413cdf0e10cSrcweir         xRet = m_xColorScheme;
414cdf0e10cSrcweir     }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir     if( !xRet.is())
417cdf0e10cSrcweir     {
418cdf0e10cSrcweir         xRet.set( createConfigColorScheme( m_xContext ));
419cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
420cdf0e10cSrcweir         m_xColorScheme = xRet;
421cdf0e10cSrcweir     }
422cdf0e10cSrcweir     return xRet;
423cdf0e10cSrcweir }
424cdf0e10cSrcweir 
setDefaultColorScheme(const Reference<chart2::XColorScheme> & xColorScheme)425cdf0e10cSrcweir void SAL_CALL Diagram::setDefaultColorScheme( const Reference< chart2::XColorScheme >& xColorScheme )
426cdf0e10cSrcweir     throw (uno::RuntimeException)
427cdf0e10cSrcweir {
428cdf0e10cSrcweir     {
429cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
430cdf0e10cSrcweir         m_xColorScheme.set( xColorScheme );
431cdf0e10cSrcweir     }
432cdf0e10cSrcweir     fireModifyEvent();
433cdf0e10cSrcweir }
434cdf0e10cSrcweir 
setDiagramData(const Reference<chart2::data::XDataSource> & xDataSource,const Sequence<beans::PropertyValue> & aArguments)435cdf0e10cSrcweir void SAL_CALL Diagram::setDiagramData(
436cdf0e10cSrcweir     const Reference< chart2::data::XDataSource >& xDataSource,
437cdf0e10cSrcweir     const Sequence< beans::PropertyValue >& aArguments )
438cdf0e10cSrcweir         throw (uno::RuntimeException)
439cdf0e10cSrcweir {
440cdf0e10cSrcweir     uno::Reference< lang::XMultiServiceFactory > xChartTypeManager( m_xContext->getServiceManager()->createInstanceWithContext(
441cdf0e10cSrcweir             C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
442cdf0e10cSrcweir     DiagramHelper::tTemplateWithServiceName aTemplateAndService = DiagramHelper::getTemplateForDiagram( this, xChartTypeManager );
443cdf0e10cSrcweir     uno::Reference< chart2::XChartTypeTemplate > xTemplate( aTemplateAndService.first );
444cdf0e10cSrcweir     if( !xTemplate.is() )
445cdf0e10cSrcweir         xTemplate.set( xChartTypeManager->createInstance( C2U("com.sun.star.chart2.template.Column") ), uno::UNO_QUERY );
446cdf0e10cSrcweir     if(!xTemplate.is())
447cdf0e10cSrcweir         return;
448cdf0e10cSrcweir     xTemplate->changeDiagramData( this, xDataSource, aArguments );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir 
451cdf0e10cSrcweir // ____ XTitled ____
getTitleObject()452cdf0e10cSrcweir uno::Reference< chart2::XTitle > SAL_CALL Diagram::getTitleObject()
453cdf0e10cSrcweir     throw (uno::RuntimeException)
454cdf0e10cSrcweir {
455cdf0e10cSrcweir     MutexGuard aGuard( GetMutex() );
456cdf0e10cSrcweir     return m_xTitle;
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
setTitleObject(const uno::Reference<chart2::XTitle> & xNewTitle)459cdf0e10cSrcweir void SAL_CALL Diagram::setTitleObject( const uno::Reference< chart2::XTitle >& xNewTitle )
460cdf0e10cSrcweir     throw (uno::RuntimeException)
461cdf0e10cSrcweir {
462cdf0e10cSrcweir     Reference< chart2::XTitle > xOldTitle;
463cdf0e10cSrcweir     {
464cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
465cdf0e10cSrcweir         if( m_xTitle == xNewTitle )
466cdf0e10cSrcweir             return;
467cdf0e10cSrcweir         xOldTitle = m_xTitle;
468cdf0e10cSrcweir         m_xTitle = xNewTitle;
469cdf0e10cSrcweir     }
470cdf0e10cSrcweir     if( xOldTitle.is())
471cdf0e10cSrcweir         ModifyListenerHelper::removeListener( xOldTitle, m_xModifyEventForwarder );
472cdf0e10cSrcweir     if( xNewTitle.is())
473cdf0e10cSrcweir         ModifyListenerHelper::addListener( xNewTitle, m_xModifyEventForwarder );
474cdf0e10cSrcweir     fireModifyEvent();
475cdf0e10cSrcweir }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir // ____ X3DDefaultSetter ____
set3DSettingsToDefault()478cdf0e10cSrcweir void SAL_CALL Diagram::set3DSettingsToDefault()
479cdf0e10cSrcweir     throw (uno::RuntimeException)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     ThreeDHelper::set3DSettingsToDefault( this );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
setDefaultRotation()484cdf0e10cSrcweir void SAL_CALL Diagram::setDefaultRotation()
485cdf0e10cSrcweir     throw (uno::RuntimeException)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir     ThreeDHelper::setDefaultRotation( this );
488cdf0e10cSrcweir }
489cdf0e10cSrcweir 
setDefaultIllumination()490cdf0e10cSrcweir void SAL_CALL Diagram::setDefaultIllumination()
491cdf0e10cSrcweir     throw (uno::RuntimeException)
492cdf0e10cSrcweir {
493cdf0e10cSrcweir     ThreeDHelper::setDefaultIllumination( this );
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
496cdf0e10cSrcweir // ____ XCoordinateSystemContainer ____
addCoordinateSystem(const uno::Reference<chart2::XCoordinateSystem> & aCoordSys)497cdf0e10cSrcweir void SAL_CALL Diagram::addCoordinateSystem(
498cdf0e10cSrcweir     const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
499cdf0e10cSrcweir     throw (lang::IllegalArgumentException,
500cdf0e10cSrcweir            uno::RuntimeException)
501cdf0e10cSrcweir {
502cdf0e10cSrcweir     {
503cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
504cdf0e10cSrcweir         if( ::std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys )
505cdf0e10cSrcweir             != m_aCoordSystems.end())
506cdf0e10cSrcweir             throw lang::IllegalArgumentException();
507cdf0e10cSrcweir 
508cdf0e10cSrcweir         if( m_aCoordSystems.size()>=1 )
509cdf0e10cSrcweir         {
510cdf0e10cSrcweir             OSL_ENSURE( false, "more than one coordinatesystem is not supported yet by the fileformat" );
511cdf0e10cSrcweir             return;
512cdf0e10cSrcweir         }
513cdf0e10cSrcweir         m_aCoordSystems.push_back( aCoordSys );
514cdf0e10cSrcweir     }
515cdf0e10cSrcweir     ModifyListenerHelper::addListener( aCoordSys, m_xModifyEventForwarder );
516cdf0e10cSrcweir     fireModifyEvent();
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
removeCoordinateSystem(const uno::Reference<chart2::XCoordinateSystem> & aCoordSys)519cdf0e10cSrcweir void SAL_CALL Diagram::removeCoordinateSystem(
520cdf0e10cSrcweir     const uno::Reference< chart2::XCoordinateSystem >& aCoordSys )
521cdf0e10cSrcweir     throw (container::NoSuchElementException,
522cdf0e10cSrcweir            uno::RuntimeException)
523cdf0e10cSrcweir {
524cdf0e10cSrcweir     {
525cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
526cdf0e10cSrcweir         ::std::vector< uno::Reference< chart2::XCoordinateSystem > >::iterator
527cdf0e10cSrcweir               aIt( ::std::find( m_aCoordSystems.begin(), m_aCoordSystems.end(), aCoordSys ));
528cdf0e10cSrcweir         if( aIt == m_aCoordSystems.end())
529cdf0e10cSrcweir             throw container::NoSuchElementException(
530cdf0e10cSrcweir                 C2U( "The given coordinate-system is no element of the container" ),
531cdf0e10cSrcweir                 static_cast< uno::XWeak * >( this ));
532cdf0e10cSrcweir         m_aCoordSystems.erase( aIt );
533cdf0e10cSrcweir     }
534cdf0e10cSrcweir     ModifyListenerHelper::removeListener( aCoordSys, m_xModifyEventForwarder );
535cdf0e10cSrcweir     fireModifyEvent();
536cdf0e10cSrcweir }
537cdf0e10cSrcweir 
getCoordinateSystems()538cdf0e10cSrcweir uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > SAL_CALL Diagram::getCoordinateSystems()
539cdf0e10cSrcweir     throw (uno::RuntimeException)
540cdf0e10cSrcweir {
541cdf0e10cSrcweir     MutexGuard aGuard( GetMutex() );
542cdf0e10cSrcweir     return ContainerHelper::ContainerToSequence( m_aCoordSystems );
543cdf0e10cSrcweir }
544cdf0e10cSrcweir 
setCoordinateSystems(const Sequence<Reference<chart2::XCoordinateSystem>> & aCoordinateSystems)545cdf0e10cSrcweir void SAL_CALL Diagram::setCoordinateSystems(
546cdf0e10cSrcweir     const Sequence< Reference< chart2::XCoordinateSystem > >& aCoordinateSystems )
547cdf0e10cSrcweir     throw (lang::IllegalArgumentException,
548cdf0e10cSrcweir            uno::RuntimeException)
549cdf0e10cSrcweir {
550cdf0e10cSrcweir     tCoordinateSystemContainerType aNew;
551cdf0e10cSrcweir     tCoordinateSystemContainerType aOld;
552cdf0e10cSrcweir     if( aCoordinateSystems.getLength()>0 )
553cdf0e10cSrcweir     {
554cdf0e10cSrcweir         OSL_ENSURE( aCoordinateSystems.getLength()<=1, "more than one coordinatesystem is not supported yet by the fileformat" );
555cdf0e10cSrcweir         aNew.push_back( aCoordinateSystems[0] );
556cdf0e10cSrcweir     }
557cdf0e10cSrcweir     {
558cdf0e10cSrcweir         MutexGuard aGuard( GetMutex() );
559cdf0e10cSrcweir         std::swap( aOld, m_aCoordSystems );
560cdf0e10cSrcweir         m_aCoordSystems = aNew;
561cdf0e10cSrcweir     }
562cdf0e10cSrcweir     ModifyListenerHelper::removeListenerFromAllElements( aOld, m_xModifyEventForwarder );
563cdf0e10cSrcweir     ModifyListenerHelper::addListenerToAllElements( aNew, m_xModifyEventForwarder );
564cdf0e10cSrcweir     fireModifyEvent();
565cdf0e10cSrcweir }
566cdf0e10cSrcweir 
567cdf0e10cSrcweir // ____ XCloneable ____
createClone()568cdf0e10cSrcweir Reference< util::XCloneable > SAL_CALL Diagram::createClone()
569cdf0e10cSrcweir     throw (uno::RuntimeException)
570cdf0e10cSrcweir {
571cdf0e10cSrcweir     MutexGuard aGuard( GetMutex() );
572cdf0e10cSrcweir     return Reference< util::XCloneable >( new Diagram( *this ));
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir // ____ XModifyBroadcaster ____
addModifyListener(const Reference<util::XModifyListener> & aListener)576cdf0e10cSrcweir void SAL_CALL Diagram::addModifyListener( const Reference< util::XModifyListener >& aListener )
577cdf0e10cSrcweir     throw (uno::RuntimeException)
578cdf0e10cSrcweir {
579cdf0e10cSrcweir     try
580cdf0e10cSrcweir     {
581cdf0e10cSrcweir         Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
582cdf0e10cSrcweir         xBroadcaster->addModifyListener( aListener );
583cdf0e10cSrcweir     }
584cdf0e10cSrcweir     catch( const uno::Exception & ex )
585cdf0e10cSrcweir     {
586cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
587cdf0e10cSrcweir     }
588cdf0e10cSrcweir }
589cdf0e10cSrcweir 
removeModifyListener(const Reference<util::XModifyListener> & aListener)590cdf0e10cSrcweir void SAL_CALL Diagram::removeModifyListener( const Reference< util::XModifyListener >& aListener )
591cdf0e10cSrcweir     throw (uno::RuntimeException)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir     try
594cdf0e10cSrcweir     {
595cdf0e10cSrcweir         Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
596cdf0e10cSrcweir         xBroadcaster->removeModifyListener( aListener );
597cdf0e10cSrcweir     }
598cdf0e10cSrcweir     catch( const uno::Exception & ex )
599cdf0e10cSrcweir     {
600cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
601cdf0e10cSrcweir     }
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir // ____ XModifyListener ____
modified(const lang::EventObject & aEvent)605cdf0e10cSrcweir void SAL_CALL Diagram::modified( const lang::EventObject& aEvent )
606cdf0e10cSrcweir     throw (uno::RuntimeException)
607cdf0e10cSrcweir {
608cdf0e10cSrcweir     m_xModifyEventForwarder->modified( aEvent );
609cdf0e10cSrcweir }
610cdf0e10cSrcweir 
611cdf0e10cSrcweir // ____ XEventListener (base of XModifyListener) ____
disposing(const lang::EventObject &)612cdf0e10cSrcweir void SAL_CALL Diagram::disposing( const lang::EventObject& /* Source */ )
613cdf0e10cSrcweir     throw (uno::RuntimeException)
614cdf0e10cSrcweir {
615cdf0e10cSrcweir     // nothing
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir // ____ OPropertySet ____
firePropertyChangeEvent()619cdf0e10cSrcweir void Diagram::firePropertyChangeEvent()
620cdf0e10cSrcweir {
621cdf0e10cSrcweir     fireModifyEvent();
622cdf0e10cSrcweir }
623cdf0e10cSrcweir 
fireModifyEvent()624cdf0e10cSrcweir void Diagram::fireModifyEvent()
625cdf0e10cSrcweir {
626cdf0e10cSrcweir     m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
627cdf0e10cSrcweir }
628cdf0e10cSrcweir 
629cdf0e10cSrcweir // ============================================================
630cdf0e10cSrcweir 
getSupportedServiceNames_Static()631cdf0e10cSrcweir Sequence< OUString > Diagram::getSupportedServiceNames_Static()
632cdf0e10cSrcweir {
633cdf0e10cSrcweir     Sequence< OUString > aServices( 3 );
634cdf0e10cSrcweir 
635cdf0e10cSrcweir     aServices[ 0 ] = C2U( "com.sun.star.chart2.Diagram" );
636cdf0e10cSrcweir     aServices[ 1 ] = C2U( "com.sun.star.layout.LayoutElement" );
637cdf0e10cSrcweir     aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
638cdf0e10cSrcweir     return aServices;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir 
641cdf0e10cSrcweir // ____ OPropertySet ____
GetDefaultValue(sal_Int32 nHandle) const642cdf0e10cSrcweir uno::Any Diagram::GetDefaultValue( sal_Int32 nHandle ) const
643cdf0e10cSrcweir     throw(beans::UnknownPropertyException)
644cdf0e10cSrcweir {
645cdf0e10cSrcweir     const tPropertyValueMap& rStaticDefaults = *StaticDiagramDefaults::get();
646cdf0e10cSrcweir     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
647cdf0e10cSrcweir     if( aFound == rStaticDefaults.end() )
648cdf0e10cSrcweir         return uno::Any();
649cdf0e10cSrcweir     return (*aFound).second;
650cdf0e10cSrcweir }
651cdf0e10cSrcweir 
652cdf0e10cSrcweir // ____ OPropertySet ____
getInfoHelper()653cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & SAL_CALL Diagram::getInfoHelper()
654cdf0e10cSrcweir {
655cdf0e10cSrcweir     return *StaticDiagramInfoHelper::get();
656cdf0e10cSrcweir }
657cdf0e10cSrcweir 
658cdf0e10cSrcweir // ____ XPropertySet ____
getPropertySetInfo()659cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL Diagram::getPropertySetInfo()
660cdf0e10cSrcweir     throw (uno::RuntimeException)
661cdf0e10cSrcweir {
662cdf0e10cSrcweir     return *StaticDiagramInfo::get();
663cdf0e10cSrcweir }
664cdf0e10cSrcweir 
665cdf0e10cSrcweir // ____ XFastPropertySet ____
setFastPropertyValue(sal_Int32 nHandle,const Any & rValue)666cdf0e10cSrcweir void SAL_CALL Diagram::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
667cdf0e10cSrcweir     throw(beans::UnknownPropertyException,
668cdf0e10cSrcweir           beans::PropertyVetoException,
669cdf0e10cSrcweir           lang::IllegalArgumentException,
670cdf0e10cSrcweir           lang::WrappedTargetException, uno::RuntimeException)
671cdf0e10cSrcweir {
672cdf0e10cSrcweir     //special treatment for some 3D properties
673cdf0e10cSrcweir     if( PROP_DIAGRAM_PERSPECTIVE == nHandle )
674cdf0e10cSrcweir     {
675cdf0e10cSrcweir         sal_Int32 fPerspective = 20;
676cdf0e10cSrcweir         if( rValue >>=fPerspective )
677cdf0e10cSrcweir             ThreeDHelper::setCameraDistance( this, ThreeDHelper::PerspectiveToCameraDistance( fPerspective ) );
678cdf0e10cSrcweir     }
679cdf0e10cSrcweir     else if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle
680cdf0e10cSrcweir         || PROP_DIAGRAM_ROTATION_VERTICAL == nHandle )
681cdf0e10cSrcweir     {
682cdf0e10cSrcweir         sal_Int32 nNewAngleDegree = 0;
683cdf0e10cSrcweir         if( rValue >>=nNewAngleDegree )
684cdf0e10cSrcweir         {
685cdf0e10cSrcweir             sal_Int32 nHorizontal, nVertical;
686cdf0e10cSrcweir             ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical );
687cdf0e10cSrcweir             if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle )
688cdf0e10cSrcweir                 nHorizontal = nNewAngleDegree;
689cdf0e10cSrcweir             else
690cdf0e10cSrcweir                 nVertical = nNewAngleDegree;
691cdf0e10cSrcweir             ThreeDHelper::setRotationToDiagram( this, nHorizontal, nVertical );
692cdf0e10cSrcweir         }
693cdf0e10cSrcweir     }
694cdf0e10cSrcweir     else
695cdf0e10cSrcweir         ::property::OPropertySet::setFastPropertyValue( nHandle, rValue );
696cdf0e10cSrcweir }
697cdf0e10cSrcweir 
getFastPropertyValue(Any & rValue,sal_Int32 nHandle) const698cdf0e10cSrcweir void SAL_CALL Diagram::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
699cdf0e10cSrcweir {
700cdf0e10cSrcweir     //special treatment for some 3D properties
701cdf0e10cSrcweir     if( nHandle == PROP_DIAGRAM_PERSPECTIVE )
702cdf0e10cSrcweir     {
703cdf0e10cSrcweir         sal_Int32 nPerspective = ::basegfx::fround( ThreeDHelper::CameraDistanceToPerspective(
704cdf0e10cSrcweir             ThreeDHelper::getCameraDistance( const_cast< Diagram* >( this ) ) ) );
705cdf0e10cSrcweir         rValue = uno::makeAny(nPerspective);
706cdf0e10cSrcweir     }
707cdf0e10cSrcweir     else if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle
708cdf0e10cSrcweir         || PROP_DIAGRAM_ROTATION_VERTICAL == nHandle )
709cdf0e10cSrcweir     {
710cdf0e10cSrcweir         sal_Int32 nHorizontal, nVertical;
711cdf0e10cSrcweir         ThreeDHelper::getRotationFromDiagram( const_cast< Diagram* >( this ), nHorizontal, nVertical );
712cdf0e10cSrcweir         sal_Int32 nAngleDegree = 0;
713cdf0e10cSrcweir         if( PROP_DIAGRAM_ROTATION_HORIZONTAL == nHandle )
714cdf0e10cSrcweir             nAngleDegree = nHorizontal;
715cdf0e10cSrcweir         else
716cdf0e10cSrcweir             nAngleDegree = nVertical;
717cdf0e10cSrcweir         rValue = uno::makeAny(nAngleDegree);
718cdf0e10cSrcweir     }
719cdf0e10cSrcweir     else
720cdf0e10cSrcweir         ::property::OPropertySet::getFastPropertyValue( rValue,nHandle );
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
723cdf0e10cSrcweir // ================================================================================
724cdf0e10cSrcweir 
725cdf0e10cSrcweir using impl::Diagram_Base;
726cdf0e10cSrcweir 
727cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( Diagram, Diagram_Base, ::property::OPropertySet )
728cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( Diagram, Diagram_Base, ::property::OPropertySet )
729cdf0e10cSrcweir 
730cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
731cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( Diagram,
732cdf0e10cSrcweir                              C2U( "com.sun.star.comp.chart2.Diagram" ));
733cdf0e10cSrcweir 
734cdf0e10cSrcweir } //  namespace chart
735