summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-05-22 17:56:15 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-05-22 17:56:15 +0000
commitfee77901acf77a077c88babeba6ee5432614a691 (patch)
treea402995705b33ff4ba3bd5858697f6d3c8e2aa7a /chart2
parentf8051ba75dac6a172bec02623255fb7886239849 (diff)
INTEGRATION: CWS chart2mst3 (1.9.4); FILE MERGED
2006/10/18 17:15:33 bm 1.9.4.11: RESYNC: (1.10-1.11); FILE MERGED 2005/11/28 15:35:41 bm 1.9.4.10: BarConnectors implemented the old way (all series at once) but model offers the property ConnectDataPoints for each series independently 2005/11/25 16:22:38 iha 1.9.4.9: correct labels at z axis for deep stacking 2005/11/23 15:13:37 iha 1.9.4.8: support BarOverlap and GapWidth 2005/10/07 12:07:05 bm 1.9.4.7: RESYNC: (1.9-1.10); FILE MERGED 2005/09/16 16:50:15 iha 1.9.4.6: no creation of dummy categories in model - instead trigger generation of missing labels and categories in view 2005/04/11 09:32:54 iha 1.9.4.5: defines for servicenames for charttypes (fixed apply to 2nd axis again) 2004/09/17 12:20:48 iha 1.9.4.4: implement api redesign - dimension property 2004/09/17 11:38:59 iha 1.9.4.3: implement api redesign - dimension property 2004/03/02 13:24:48 iha 1.9.4.2: abilities of stockchart/candlestick 2004/02/13 16:51:50 bm 1.9.4.1: join from changes on branch bm_post_chart01
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx195
1 files changed, 96 insertions, 99 deletions
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 769dfee6e6ad..a1fad88ab5a5 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: ChartTypeHelper.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 13:22:39 $
+ * last change: $Author: vg $ $Date: 2007-05-22 18:56:15 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -37,7 +37,9 @@
#include "precompiled_chart2.hxx"
#include "ChartTypeHelper.hxx"
+#include "DiagramHelper.hxx"
#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
// header for define DBG_ASSERT
#ifndef _TOOLS_DEBUG_HXX
@@ -49,123 +51,105 @@
#endif
//.............................................................................
-namespace chart
-{
-//.............................................................................
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-sal_Bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XChartType >& xChartType )
+
+//.............................................................................
+namespace chart
+{
+
+sal_Bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
{
//form tab only for 3D-bar and 3D-column charts.
//@todo ask charttype itself --> need model change first
if(xChartType.is())
{
- sal_Int32 nDimension=2;
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension;
- }
- if(nDimension==3)
+ if(nDimensionCount==3)
{
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.equalsIgnoreAsciiCase(C2U("com.sun.star.chart2.BarChart")) )
+ if( aChartTypeName.equals(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
return sal_True;
- if( aChartTypeName.equalsIgnoreAsciiCase(C2U("com.sun.star.chart2.ColumnChart")) )
+ if( aChartTypeName.equals(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
return sal_True;
}
}
return sal_False;
}
-sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XChartType >& xChartType )
+sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
{
//3D charts, pie, net and stock do not support statistic properties
//@todo ask charttype itself (and series? --> stock chart?) --> need model change first
if(xChartType.is())
{
- sal_Int32 nDimension=2;
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension;
- }
- if(nDimension==3)
+ if(nDimensionCount==3)
return sal_False;
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.match(C2U("com.sun.star.chart2.PieChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
return sal_False;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.Net")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.Stock")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return sal_False;
}
return sal_True;
}
-sal_Bool ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference< XChartType >& xChartType )
+sal_Bool ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
{
// note: old chart: only scatter chart
- return isSupportingStatisticProperties( xChartType );
+ return isSupportingStatisticProperties( xChartType, nDimensionCount );
}
-sal_Bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartType >& xChartType )
+sal_Bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
{
- //2D line charts do not support area properties
+ //2D line charts, net and stock do not support area properties
//@todo ask charttype itself --> need model change first
if(xChartType.is())
{
- sal_Int32 nDimension=2;
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension;
- }
- if(nDimension==2)
+ if(nDimensionCount==2)
{
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.match(C2U("com.sun.star.chart2.LineChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
return sal_False;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.ScatterChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
+ return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return sal_False;
}
}
return sal_True;
}
-sal_Bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChartType >& xChartType )
+sal_Bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
{
//2D line charts, 2D scatter charts and 2D net charts do support symbols
//@todo ask charttype itself --> need model change first
if(xChartType.is())
{
- sal_Int32 nDimension=2;
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension;
- }
- if(nDimension==3)
+ if(nDimensionCount==3)
return sal_False;
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.match(C2U("com.sun.star.chart2.LineChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) )
return sal_True;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.ScatterChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
return sal_True;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.Net")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_True;
}
return sal_False;
}
-sal_Bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionIndex )
+sal_Bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
{
//pie charts do not support axis at all
//no 3rd axis for 2D charts
@@ -174,87 +158,100 @@ sal_Bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType
if(xChartType.is())
{
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.match(C2U("com.sun.star.chart2.PieChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
return sal_False;
if( nDimensionIndex == 2 )
- return ChartTypeHelper::getDimensionCount( xChartType ) == 3;
+ return nDimensionCount == 3;
}
return sal_True;
}
-sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionIndex )
+sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex )
{
//3D, pie and net charts do not support a secondary axis at all
//@todo ask charttype itself --> need model change first
if(xChartType.is())
{
- sal_Int32 nDimension=2;
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension;
- }
- if(nDimension==3)
+ if(nDimensionCount==3)
return sal_False;
rtl::OUString aChartTypeName = xChartType->getChartType();
- if( aChartTypeName.match(C2U("com.sun.star.chart2.PieChart")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
return sal_False;
- if( aChartTypeName.match(C2U("com.sun.star.chart2.Net")) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
}
return sal_True;
}
-AxisType ChartTypeHelper::getAxisType( const uno::Reference<
+sal_Bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties(
+ const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //2D bar charts do support a this special properties
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_Bool ChartTypeHelper::isSupportingBarConnectors(
+ const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount )
+{
+ //2D bar charts with stacked series support this
+
+ //@todo ask charttype itself --> need model change first
+ if(xChartType.is())
+ {
+ if(nDimensionCount==3)
+ return sal_False;
+
+ StackMode eStackMode = DiagramHelper::getStackModeFromChartType( xChartType, 0 );
+ if( eStackMode != StackMode_Y_STACKED )
+ return sal_False;
+
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) )
+ return sal_True;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ return sal_True; // note: old chart was false here
+ }
+ return sal_False;
+}
+
+
+sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
XChartType >& xChartType, sal_Int32 nDimensionIndex )
{
+ //retruned is a constant from constant group ::com::sun::star::chart2::AxisType
+
//@todo ask charttype itself --> need model change first
if(!xChartType.is())
- return AxisType_CATEGORY;
+ return AxisType::CATEGORY;
rtl::OUString aChartTypeName = xChartType->getChartType();
if(2==nDimensionIndex)//z-axis
- return AxisType_CATEGORY;
+ return AxisType::SERIES;
if(1==nDimensionIndex)//y-axis
- return AxisType_REALNUMBER;
+ return AxisType::REALNUMBER;
if(0==nDimensionIndex)//x-axis
{
- if( aChartTypeName.match(C2U("com.sun.star.chart2.ScatterChart")) )
- return AxisType_REALNUMBER;
- return AxisType_CATEGORY;
- }
- return AxisType_CATEGORY;
-}
-
-sal_Int32 ChartTypeHelper::getDimensionCount( const uno::Reference< XChartType >& xChartType )
-{
- sal_Int32 nDimension = 2;
- if( xChartType.is() )
- {
- uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
- if( xChartTypeProp.is())
- {
- try
- {
- if( (xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension) )
- {
- return nDimension;
- }
- else
- {
- DBG_ERROR( "Couldn't get Dimension from ChartTypeGroup" );
- }
- }
- catch( beans::UnknownPropertyException ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- }
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ return AxisType::REALNUMBER;
+ return AxisType::CATEGORY;
}
- return nDimension;
+ return AxisType::CATEGORY;
}
//.............................................................................