summaryrefslogtreecommitdiff
path: root/chart2/source/model/template/NetChartType.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-05-22 17:49:59 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-05-22 17:49:59 +0000
commit24ae5197a979b06d00ec96a4f29e84cae0cb54f2 (patch)
treec1b33cfd0d66b6a8ae932844f7133e39359a8333 /chart2/source/model/template/NetChartType.cxx
parent332f0327d6c41a5e3e5ab86464546e74115da4f7 (diff)
INTEGRATION: CWS chart2mst3 (1.2.4); FILE MERGED
2006/10/18 17:14:21 bm 1.2.4.18: RESYNC: (1.3-1.4); FILE MERGED 2006/04/10 12:25:13 iha 1.2.4.17: api restructure axis, grids, scales and increments 2006/03/29 22:24:45 iha 1.2.4.16: restructure legend entry creation + legend entries in data labels 2005/10/24 11:06:51 iha 1.2.4.15: coordinate system restructure 2005/10/13 17:39:03 iha 1.2.4.14: renamed BoundedCoordinateSystem to CoordinateSystem 2005/10/07 12:04:02 bm 1.2.4.13: RESYNC: (1.2-1.3); FILE MERGED 2005/09/16 16:50:12 iha 1.2.4.12: no creation of dummy categories in model - instead trigger generation of missing labels and categories in view 2005/08/03 16:36:24 bm 1.2.4.11: algohelper.hxx split up into CommonFunctors.hxx ContainerHelper.hxx CloneHelper.hxx 2005/07/19 11:42:24 iha 1.2.4.10: change net orientation to old default 2005/04/11 09:40:36 iha 1.2.4.9: defines for servicenames for charttypes (fixed apply to 2nd axis again) 2005/03/30 16:31:12 bm 1.2.4.8: make model cloneable (+first undo implementation) 2004/09/16 14:42:46 bm 1.2.4.7: API simplification 2004/09/16 13:24:50 bm 1.2.4.6: API simplification 2004/09/16 12:27:28 bm 1.2.4.5: API simplification 2004/09/15 17:32:06 bm 1.2.4.4: API simplification 2004/04/01 10:53:10 bm 1.2.4.3: XChartType: may return a coordinate system now 2004/03/23 16:48:05 bm 1.2.4.2: show symbols in legend 2004/03/03 14:57:17 bm 1.2.4.1: support LegendSymbolStyle property
Diffstat (limited to 'chart2/source/model/template/NetChartType.cxx')
-rw-r--r--chart2/source/model/template/NetChartType.cxx186
1 files changed, 181 insertions, 5 deletions
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index 0da96277e1de..1be89098be67 100644
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: NetChartType.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 13:19:26 $
+ * last change: $Author: vg $ $Date: 2007-05-22 18:49:59 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -36,24 +36,200 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "NetChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CHART2_AXISTYPE_HPP_
+#include <com/sun/star/chart2/AxisType.hpp>
+#endif
using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & rOutMap )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
namespace chart
{
-NetChartType::NetChartType() :
- ChartType( 2 )
+NetChartType::NetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ ChartType( xContext )
{}
+NetChartType::NetChartType( const NetChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
NetChartType::~NetChartType()
{}
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new NetChartType( *this ));
+}
+
// ____ XChartType ____
::rtl::OUString SAL_CALL NetChartType::getChartType()
throw (uno::RuntimeException)
{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.NetChart" ));
+ return CHART2_SERVICE_NAME_CHARTTYPE_NET;
}
+Reference< XCoordinateSystem > SAL_CALL
+ NetChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( DimensionCount != 2 )
+ throw lang::IllegalArgumentException(
+ C2U( "NetChart must be two-dimensional" ),
+ static_cast< ::cppu::OWeakObject* >( this ), 0 );
+
+ Reference< XCoordinateSystem > xResult(
+ new PolarCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ Reference< XAxis > xAxis( xResult->getAxisByDimension( 0, MAIN_AXIS_INDEX ) );
+ if( xAxis.is() )
+ {
+ ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Scaling = new LinearScaling( 1.0, 0.0 );
+ aScaleData.AxisType = AxisType::CATEGORY;
+ aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ xAxis = xResult->getAxisByDimension( 1, MAIN_AXIS_INDEX );
+ if( xAxis.is() )
+ {
+ ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = AxisOrientation_MATHEMATICAL;
+ aScaleData.AxisType = AxisType::REALNUMBER;
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+// ____ OPropertySet ____
+uno::Any NetChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL NetChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ NetChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_NET;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" );
+ aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( NetChartType,
+ C2U( "com.sun.star.comp.chart.NetChartType" ));
+
} // namespace chart