summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-12-01 17:50:41 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-12-01 17:50:41 +0000
commitb997e375bb9457d7b90e4b38f23ed02c810ee21a (patch)
tree87d81913dbf06785e84fb830dc520fbb55cd2087 /chart2
parentdb58700b3540d71169898f7832cdcfb7c5b2479d (diff)
parentf9f4f18d1b54fe37352a5a717301b8f3d2414ea6 (diff)
chartshapes: merge with DEV300 m62
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx7
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc4
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src8
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc4
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src8
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx11
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx3
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx176
-rw-r--r--chart2/source/controller/dialogs/Strings.src32
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src4
-rw-r--r--chart2/source/controller/dialogs/dlg_DataSource.cxx13
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx3
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx4
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertTrendline.cxx3
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx74
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx3
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx23
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.hxx7
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.cxx23
-rw-r--r--chart2/source/controller/dialogs/tp_RangeChooser.hxx6
-rw-r--r--chart2/source/controller/inc/ObjectHierarchy.hxx3
-rw-r--r--chart2/source/controller/inc/ObjectNameProvider.hxx9
-rw-r--r--chart2/source/controller/inc/dlg_DataSource.hxx3
-rw-r--r--chart2/source/controller/main/ChartController.cxx148
-rw-r--r--chart2/source/controller/main/ChartController.hxx58
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx422
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx279
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx510
-rw-r--r--chart2/source/controller/main/ControllerCommandDispatch.cxx173
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx328
-rw-r--r--chart2/source/controller/main/ElementSelector.hxx125
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx306
-rw-r--r--chart2/source/controller/main/_serviceregistration_controller.cxx9
-rw-r--r--chart2/source/controller/main/makefile.mk1
-rw-r--r--chart2/source/controller/makefile.mk1
-rw-r--r--chart2/source/inc/AxisHelper.hxx8
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx2
-rw-r--r--chart2/source/inc/CommonConverters.hxx4
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx21
-rw-r--r--chart2/source/inc/LegendHelper.hxx10
-rw-r--r--chart2/source/inc/RegressionCurveHelper.hxx8
-rw-r--r--chart2/source/inc/Strings.hrc13
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx1
-rw-r--r--chart2/source/model/inc/DataSeries.hxx4
-rw-r--r--chart2/source/model/main/DataSeries.cxx25
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx18
-rw-r--r--chart2/source/model/template/FilledNetChartType.cxx97
-rw-r--r--chart2/source/model/template/FilledNetChartType.hxx66
-rw-r--r--chart2/source/model/template/NetChartType.cxx120
-rw-r--r--chart2/source/model/template/NetChartType.hxx40
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx28
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.hxx4
-rw-r--r--chart2/source/model/template/_serviceregistration_charttypes.cxx9
-rw-r--r--chart2/source/model/template/makefile.mk1
-rw-r--r--chart2/source/tools/CharacterProperties.cxx15
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx29
-rw-r--r--chart2/source/tools/CommonConverters.cxx23
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx182
-rw-r--r--chart2/source/tools/DiagramHelper.cxx2
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx10
-rw-r--r--chart2/source/tools/LegendHelper.cxx48
-rw-r--r--chart2/source/tools/RegressionCurveHelper.cxx51
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx5
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx64
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx2
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx4
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx7
-rw-r--r--chart2/source/view/inc/VCoordinateSystem.hxx4
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx20
-rw-r--r--chart2/source/view/main/VDataSeries.cxx84
-rw-r--r--chart2/source/view/makefile.mk2
-rw-r--r--chart2/uiconfig/menubar/menubar.xml20
-rw-r--r--chart2/uiconfig/toolbar/toolbar.xml3
76 files changed, 3215 insertions, 644 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index d848bf861268..e9c2c4ae39ac 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -96,6 +96,7 @@ enum eServiceType
SERVICE_NAME_DONUT_DIAGRAM,
SERVICE_NAME_LINE_DIAGRAM,
SERVICE_NAME_NET_DIAGRAM,
+ SERVICE_NAME_FILLED_NET_DIAGRAM,
SERVICE_NAME_PIE_DIAGRAM,
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
@@ -125,6 +126,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM )
( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM )
( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM )
( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM )
( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM )
( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM )
@@ -1342,6 +1344,14 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bCreateDiagram = true;
}
break;
+ case SERVICE_NAME_FILLED_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
case SERVICE_NAME_PIE_DIAGRAM:
if( xManagerFact.is())
{
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index fe1359aab7f3..4a02d9aa99e5 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -538,6 +538,10 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
if( aName.indexOf( C2U("Scatter") ) != -1 )
return C2U( "com.sun.star.chart.XYDiagram" );
+ // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
+ if( aName.indexOf( C2U("FilledNet") ) != -1 )
+ return C2U( "com.sun.star.chart.FilledNetDiagram" );
+
// "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
// "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
// "PercentStackedNetLine"
@@ -591,6 +595,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) )
+
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) )
diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
index 07ed2eeec0d5..8823b582a28e 100644
--- a/chart2/source/controller/dialogs/Bitmaps.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps.hrc
@@ -173,8 +173,8 @@
#define BMP_NET_SYMB_STACK (RID_APP_START + 77)
#define BMP_NET_LINESYMB (RID_APP_START + 78)
#define BMP_NET_LINESYMB_STACK (RID_APP_START + 79)
-#define BMP_NET_FILLED (RID_APP_START + 80)
-#define BMP_NET_FILLED_STACKED (RID_APP_START + 81)
+#define BMP_NET_FILL (RID_APP_START + 80)
+#define BMP_NET_FILL_STACK (RID_APP_START + 81)
//----------------------
// Stock Chart Subtypes
diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src
index 35a897848fb1..67d8588897d8 100644
--- a/chart2/source/controller/dialogs/Bitmaps.src
+++ b/chart2/source/controller/dialogs/Bitmaps.src
@@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK
{
File = "netlinepointstack_52x60.png" ;
};
-Bitmap BMP_NET_FILLED
+Bitmap BMP_NET_FILL
{
- File = "net_52x60.png" ;
+ File = "netfill_52x60.png" ;
};
-Bitmap BMP_NET_FILLED_STACKED
+Bitmap BMP_NET_FILL_STACK
{
- File = "netstack_52x60.png" ;
+ File = "netstackfill_52x60.png" ;
};
//---------------------
Bitmap BMP_PYRAMIDQ_3D_1
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
index 84a23ba426bc..8dd4acaffd15 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
@@ -173,8 +173,8 @@
#define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77)
#define BMP_NET_LINESYMB_HC (RID_SCH_START + 78)
#define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79)
-#define BMP_NET_FILLED_HC (RID_SCH_START + 80)
-#define BMP_NET_FILLED_STACKED_HC (RID_SCH_START + 81)
+#define BMP_NET_FILL_HC (RID_SCH_START + 80)
+#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81)
//----------------------
// Stock Chart Subtypes
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src
index 0fb7ef5e5a1a..a82893273ae2 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.src
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.src
@@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK_HC
{
File = "netlinepointstack_52x60_h.png" ;
};
-Bitmap BMP_NET_FILLED_HC
+Bitmap BMP_NET_FILL_HC
{
- File = "net_52x60_h.png" ;
+ File = "netfill_52x60_h.png" ;
};
-Bitmap BMP_NET_FILLED_STACKED_HC
+Bitmap BMP_NET_FILL_STACK_HC
{
- File = "netstack_52x60_h.png" ;
+ File = "netstackfill_52x60_h.png" ;
};
//---------------------
Bitmap BMP_PYRAMIDQ_3D_1_HC
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index de57e82e58da..fa51d17a03d8 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -1000,6 +1000,10 @@ const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTempla
( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
+
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) )
;
return m_aTemplateMap;
}
@@ -1012,17 +1016,20 @@ void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIs
rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) );
rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) );
rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) );
}
else
{
rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) );
rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) );
rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) );
+ rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) );
}
rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) );
rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) );
rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) );
+ rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) );
}
void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
{
@@ -1040,6 +1047,10 @@ void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rPa
rParameter.bSymbols = false;
rParameter.bLines = true;
break;
+ case 4:
+ rParameter.bSymbols = false;
+ rParameter.bLines = false;
+ break;
default:
rParameter.bSymbols = true;
rParameter.bLines = false;
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 0a9b58758de6..56ef98b159ba 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -413,7 +413,8 @@ Image SeriesHeader::GetChartTypeImage(
{
aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC );
}
- else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET ))
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )
+ || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
{
aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC );
}
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 1ed974814ea7..24b717adba7f 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -87,6 +87,16 @@ OUString lcl_getDataSeriesName( const rtl::OUString& rObjectCID, const Reference
return aRet;
}
+OUString lcl_getFullSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel )
+{
+ OUString aRet = String(SchResId(STR_TIP_DATASERIES));
+ OUString aWildcard( C2U("%SERIESNAME") );
+ sal_Int32 nIndex = aRet.indexOf( aWildcard );
+ if( nIndex != -1 )
+ aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ return aRet;
+}
+
void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rNext )
{
if( rOut.getLength() && rNext.getLength() )
@@ -288,22 +298,27 @@ rtl::OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural
aRet=String(SchResId(STR_OBJECT_LABEL));
break;
case OBJECTTYPE_DATA_ERRORS:
- aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe distinguish plural singular
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe distinguish plural singular
break;
case OBJECTTYPE_DATA_ERRORS_X:
- aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
break;
case OBJECTTYPE_DATA_ERRORS_Y:
- aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
break;
case OBJECTTYPE_DATA_ERRORS_Z:
- aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future
+ aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future
break;
case OBJECTTYPE_DATA_AVERAGE_LINE:
aRet=String(SchResId(STR_OBJECT_AVERAGE_LINE));
break;
case OBJECTTYPE_DATA_CURVE:
- aRet=String(SchResId(STR_OBJECT_CURVE));
+ {
+ if(bPlural)
+ aRet=String(SchResId(STR_OBJECT_CURVES));
+ else
+ aRet=String(SchResId(STR_OBJECT_CURVE));
+ }
break;
case OBJECTTYPE_DATA_STOCK_RANGE:
//aRet=String(SchResId());
@@ -333,15 +348,24 @@ rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID
Reference< XAxis > xAxis(
ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY );
- sal_Int32 nDimensionIndex = AxisHelper::getDimensionIndexOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nCooSysIndex = 0;
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ), nCooSysIndex, nDimensionIndex, nAxisIndex );
switch(nDimensionIndex)
{
case 0://x-axis
- aRet=String(SchResId(STR_OBJECT_AXIS_X));
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_X));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_X_AXIS));
break;
case 1://y-axis
- aRet=String(SchResId(STR_OBJECT_AXIS_Y));
+ if( nAxisIndex == 0 )
+ aRet=String(SchResId(STR_OBJECT_AXIS_Y));
+ else
+ aRet=String(SchResId(STR_OBJECT_SECONDARY_Y_AXIS));
break;
case 2://z-axis
aRet=String(SchResId(STR_OBJECT_AXIS_Z));
@@ -355,6 +379,45 @@ rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID
}
//static
+OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType )
+{
+ OUString aRet;
+
+ switch(eType)
+ {
+ case TitleHelper::MAIN_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_MAIN));
+ break;
+ case TitleHelper::SUB_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SUB));
+ break;
+ case TitleHelper::X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS));
+ break;
+ case TitleHelper::Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS));
+ break;
+ case TitleHelper::Z_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS));
+ break;
+ case TitleHelper::SECONDARY_X_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS));
+ break;
+ case TitleHelper::SECONDARY_Y_AXIS_TITLE:
+ aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS));
+ break;
+ default:
+ DBG_ERROR("unknown title type");
+ break;
+ }
+
+ if( !aRet.getLength() )
+ aRet=String(SchResId(STR_OBJECT_TITLE));
+
+ return aRet;
+}
+
+//static
OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
, const Reference< frame::XModel >& xChartModel )
{
@@ -366,35 +429,7 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID
{
TitleHelper::eTitleType eType;
if( TitleHelper::getTitleType( eType, xTitle, xChartModel ) )
- {
- switch(eType)
- {
- case TitleHelper::MAIN_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_MAIN));
- break;
- case TitleHelper::SUB_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_SUB));
- break;
- case TitleHelper::X_AXIS_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS));
- break;
- case TitleHelper::Y_AXIS_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS));
- break;
- case TitleHelper::Z_AXIS_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS));
- break;
- case TitleHelper::SECONDARY_X_AXIS_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS));
- break;
- case TitleHelper::SECONDARY_Y_AXIS_TITLE:
- aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS));
- break;
- default:
- DBG_ERROR("unknown title type");
- break;
- }
- }
+ aRet = ObjectNameProvider::getTitleNameByType( eType );
}
if( !aRet.getLength() )
aRet=String(SchResId(STR_OBJECT_TITLE));
@@ -481,12 +516,7 @@ rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID,
}
else if( OBJECTTYPE_DATA_SERIES == eObjectType )
{
- aRet=String(SchResId(STR_TIP_DATASERIES));
-
- OUString aWildcard( C2U("%SERIESNAME") );
- sal_Int32 nIndex = aRet.indexOf( aWildcard );
- if( nIndex != -1 )
- aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) );
+ aRet = lcl_getFullSeriesName( rObjectCID, xChartModel );
}
else if( OBJECTTYPE_DATA_POINT == eObjectType )
{
@@ -753,7 +783,41 @@ rtl::OUString ObjectNameProvider::getNameForCID(
case OBJECTTYPE_TITLE:
return getTitleName( rObjectCID, xModel );
case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
return getGridName( rObjectCID, xModel );
+ case OBJECTTYPE_DATA_SERIES:
+ return lcl_getFullSeriesName( rObjectCID, xModel );
+ //case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ {
+ rtl::OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel );
+ aRet += C2U(" ");
+ if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += getName( OBJECTTYPE_DATA_POINT );
+ sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID );
+ aRet += C2U(" ");
+ aRet += OUString::valueOf(nPointIndex+1);
+
+ if( eType == OBJECTTYPE_DATA_LABEL )
+ {
+ aRet += C2U(" ");
+ aRet += getName( OBJECTTYPE_DATA_LABEL );
+ }
+ }
+ else
+ aRet += getName( eType );
+ return aRet;
+ }
default:
break;
}
@@ -761,6 +825,32 @@ rtl::OUString ObjectNameProvider::getNameForCID(
return getName( eType );
}
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForSeries(
+ ObjectType eObjectType,
+ const rtl::OUString& rSeriesCID,
+ const uno::Reference< chart2::XChartDocument >& xChartDocument )
+{
+ uno::Reference< frame::XModel> xChartModel( xChartDocument, uno::UNO_QUERY );
+ Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel ), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, false /*bPlural*/ ) );
+ replaceParamterInString( aRet, C2U("%SERIESNAME"), lcl_getDataSeriesName( rSeriesCID, xChartModel ) );
+ return aRet;
+ }
+ else
+ return ObjectNameProvider::getName_ObjectForAllSeries( eObjectType );
+}
+
+//static
+rtl::OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType )
+{
+ OUString aRet = String(SchResId(STR_OBJECT_FOR_ALL_SERIES));
+ replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, true /*bPlural*/ ) );
+ return aRet;
+}
//.............................................................................
} //namespace chart
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index 3b384915f2d0..b7ef643e3ff3 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -84,9 +84,9 @@ String STR_PAGE_TRANSPARENCY
Text [ en-US ] = "Transparency";
};
-String STR_PAGE_CHARACTERS
+String STR_PAGE_FONT
{
- Text [ en-US ] = "Characters" ;
+ Text [ en-US ] = "Font" ;
};
String STR_PAGE_FONT_EFFECTS
@@ -183,6 +183,14 @@ String STR_OBJECT_AXIS_Z
{
Text [ en-US ] = "Z Axis" ;
};
+String STR_OBJECT_SECONDARY_X_AXIS
+{
+ Text [ en-US ] = "Secondary X Axis" ;
+};
+String STR_OBJECT_SECONDARY_Y_AXIS
+{
+ Text [ en-US ] = "Secondary Y Axis" ;
+};
String STR_OBJECT_AXES
{
@@ -312,18 +320,18 @@ String STR_OBJECT_CURVE_EQUATION
Text[ en-US ] = "Equation";
};
-String STR_OBJECT_ERROR_INDICATOR
+String STR_OBJECT_ERROR_BARS
{
- Text [ en-US ] = "Error Indicator";
+ Text [ en-US ] = "Error Bars";
};
String STR_OBJECT_STOCK_LOSS
{
- Text [ en-US ] = "Negative Deviation";
+ Text [ en-US ] = "Stock Loss";
};
String STR_OBJECT_STOCK_GAIN
{
- Text [ en-US ] = "Positive Deviation";
+ Text [ en-US ] = "Stock Gain";
};
String STR_OBJECT_PAGE
@@ -405,6 +413,18 @@ String STR_STATUS_PIE_SEGMENT_EXPLODED
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+String STR_OBJECT_FOR_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for Data Series '%SERIESNAME'" ;
+};
+
+String STR_OBJECT_FOR_ALL_SERIES
+{
+ Text [ en-US ] = "%OBJECTNAME for all Data Series" ;
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
String STR_ACTION_EDIT_CHARTTYPE
{
Text [ en-US ] = "Edit chart type" ;
diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src
index 2234f04a3fcd..f2731b2971c2 100644
--- a/chart2/source/controller/dialogs/Strings_ChartTypes.src
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -139,6 +139,10 @@ String STR_DEEP
{
Text [ en-US ] = "Deep" ;
};
+String STR_FILLED
+{
+ Text [ en-US ] = "Filled" ;
+};
//-----------------------------------------------------------------------------
String STR_TYPE_BUBBLE
{
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index 1d76a106d72b..1aa7db1f0f17 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -202,6 +202,19 @@ DataSourceDialog::~DataSourceDialog()
delete m_pTabControl;
}
+short DataSourceDialog::Execute()
+{
+ short nResult = TabDialog::Execute();
+ if( nResult == RET_OK )
+ {
+ if( m_pRangeChooserTabePage )
+ m_pRangeChooserTabePage->commitPage();
+ if( m_pDataSourceTabPage )
+ m_pDataSourceTabPage->commitPage();
+ }
+ return nResult;
+}
+
void DataSourceDialog::setInvalidPage( TabPage * pTabPage )
{
if( pTabPage == m_pRangeChooserTabePage )
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
index 638a8f5f2994..d7eb3357e6e8 100644
--- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -51,7 +51,8 @@ DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs,
m_rInAttrs(rInAttrs)
{
FreeResource();
- SetText( ObjectNameProvider::getName(OBJECTTYPE_DATA_LABELS) );
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_LABELS ) );
+
m_apDataLabelResources->SetNumberFormatter( pFormatter );
Reset();
}
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
index e6b74c8e660a..535b07a7df38 100644
--- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -42,6 +42,7 @@
#include "ObjectIdentifier.hxx"
#include "DiagramHelper.hxx"
#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
@@ -70,7 +71,8 @@ InsertErrorBarsDialog::InsertErrorBarsDialog(
/* bNoneAvailable = */ true, eType ))
{
FreeResource();
- this->SetText( String( SchResId( STR_PAGE_YERROR_BARS )));
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) );
+
m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
}
diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
index 95c9754f3b7e..042baa292f65 100644
--- a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx
@@ -42,6 +42,7 @@
#include "ObjectIdentifier.hxx"
#include "DiagramHelper.hxx"
#include "AxisHelper.hxx"
+#include "ObjectNameProvider.hxx"
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
@@ -74,7 +75,7 @@ InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet&
m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true ))
{
FreeResource();
- this->SetText( String( SchResId( STR_OBJECT_CURVES )));
+ this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) );
}
InsertTrendlineDialog::~InsertTrendlineDialog()
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 2aa227416650..d095d54d1e07 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -143,7 +143,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType || OBJECTTYPE_DATA_LABELS==m_eObjectType);
+ bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
if( bHasSeriesProperties || bHasDataPointproperties )
@@ -222,14 +222,37 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel
{
m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
}
+ else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
+ {
+ m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
+ }
+ else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
+ {
+ m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
+ }
else
{
- ObjectType eType = m_eObjectType;
- if( OBJECTTYPE_DATA_LABEL == eType )
- eType = OBJECTTYPE_DATA_POINT;
- else if( OBJECTTYPE_DATA_LABELS == eType )
- eType = OBJECTTYPE_DATA_SERIES;
- m_aLocalizedName = ObjectNameProvider::getName(eType,m_bAffectsMultipleObjects);
+ switch( m_eObjectType )
+ {
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_CURVE:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ if( m_bAffectsMultipleObjects )
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
+ else
+ m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
+ break;
+ default:
+ m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
+ break;
+ }
}
}
}
@@ -355,7 +378,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
- AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
if( aCJKOptions.IsAsianTypographyEnabled() )
@@ -366,7 +389,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
- AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
if( aCJKOptions.IsAsianTypographyEnabled() )
@@ -375,27 +398,30 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
case OBJECTTYPE_DATA_SERIES:
case OBJECTTYPE_DATA_POINT:
- case OBJECTTYPE_DATA_LABEL:
- case OBJECTTYPE_DATA_LABELS:
- AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
+ if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
+ AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
+ if( m_pParameter->ProvidesStartingAngle())
+ AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
+
+ if( m_pParameter->HasGeometryProperties() )
+ AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
+
if(m_pParameter->HasAreaProperties())
{
AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
}
- AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
+ AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
+ break;
+
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_LABELS:
+ AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
if( aCJKOptions.IsAsianTypographyEnabled() )
AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
- AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
-// if( m_pParameter->HasStatisticProperties() )
-// AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
- if( m_pParameter->HasGeometryProperties() )
- AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
- if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
- AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
- if( m_pParameter->ProvidesStartingAngle())
- AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
+
break;
case OBJECTTYPE_AXIS:
@@ -409,7 +435,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
if( m_pParameter->HasNumberProperties() )
AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
- AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
if( aCJKOptions.IsAsianTypographyEnabled() )
AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
@@ -456,7 +482,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
- AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
+ AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
if( SvtLanguageOptions().IsCTLFontEnabled() )
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index b2d64400ef98..c35f11546d36 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -995,7 +995,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG )
aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
this->fillAllControls( aParameter );
- m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel);
+ uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY );
+ m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
}
return 0;
}
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index f499e2acc23a..ff858c5bfdf5 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -377,6 +377,29 @@ void DataSourceTabPage::initializePage()
{
}
+void DataSourceTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void DataSourceTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool DataSourceTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ updateModelFromControl( 0 /*update all*/ );
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit )
{
OUString aRange( rEdit.GetText());
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 2703836d5d1d..6c42f1cb98e2 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -87,8 +87,15 @@ public:
bool bHideDescription = false );
virtual ~DataSourceTabPage();
+ void commitPage();
+
+protected:
// OWizardPage
virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
virtual void initializePage();
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index 2c2bc3fc6892..8ba4d61a8057 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -216,6 +216,29 @@ void RangeChooserTabPage::initControlsFromModel()
m_nChangingControlCalls--;
}
+void RangeChooserTabPage::DeactivatePage()
+{
+ commitPage();
+ svt::OWizardPage::DeactivatePage();
+}
+
+void RangeChooserTabPage::commitPage()
+{
+ commitPage(eFinish);
+}
+
+sal_Bool RangeChooserTabPage::commitPage( CommitPageReason /*eReason*/ )
+{
+ //ranges may have been edited in the meanwhile (dirty is true in that case here)
+ if( isValid() )
+ {
+ changeDialogModelAccordingToControls();
+ return sal_True;//return false if this page should not be left
+ }
+ else
+ return sal_False;
+}
+
void RangeChooserTabPage::changeDialogModelAccordingToControls()
{
if(m_nChangingControlCalls>0)
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
index 01062ba4c0f1..bb508da8d9a1 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -70,10 +70,16 @@ virtual ~RangeChooserTabPage();
virtual void listeningFinished( const ::rtl::OUString & rNewRange );
virtual void disposingRangeSelection();
+ void commitPage();
+
protected: //methods
//OWizardPage
virtual void ActivatePage();
+ virtual sal_Bool commitPage( CommitPageReason eReason );
+
+ //TabPage
+ virtual void DeactivatePage();
void initControlsFromModel();
void changeDialogModelAccordingToControls();
diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx
index b4a2bdbbfb69..9e92f23241e9 100644
--- a/chart2/source/controller/inc/ObjectHierarchy.hxx
+++ b/chart2/source/controller/inc/ObjectHierarchy.hxx
@@ -64,7 +64,8 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDocument,
ExplicitValueProvider * pExplicitValueProvider = 0,
- bool bFlattenDiagram = false );
+ bool bFlattenDiagram = false,
+ bool bOrderingForElementSelector = false );
~ObjectHierarchy();
static tOID getRootNodeOID();
diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx
index 2892c769c7a0..529f253fc20a 100644
--- a/chart2/source/controller/inc/ObjectNameProvider.hxx
+++ b/chart2/source/controller/inc/ObjectNameProvider.hxx
@@ -32,6 +32,7 @@
#define _CHART2_OBJECTNAME_PROVIDER_HXX
#include "ObjectIdentifier.hxx"
+#include "TitleHelper.hxx"
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
@@ -57,12 +58,20 @@ public:
static rtl::OUString getTitleName( const rtl::OUString& rObjectCID
, const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel );
+ static rtl::OUString getTitleNameByType( TitleHelper::eTitleType eType );
static rtl::OUString getNameForCID(
const rtl::OUString& rObjectCID,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument >& xChartDocument );
+ static rtl::OUString getName_ObjectForSeries(
+ ObjectType eObjectType,
+ const rtl::OUString& rSeriesCID,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument >& xChartDocument );
+ static rtl::OUString getName_ObjectForAllSeries( ObjectType eObjectType );
+
/** Provides help texts for the various chart elements.
The parameter rObjectCID has to be a ClassifiedIdentifier - see class ObjectIdentifier.
*/
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index cfbe7aa561e8..331136607e75 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -68,6 +68,9 @@ public:
::com::sun::star::uno::XComponentContext > & xContext );
virtual ~DataSourceDialog();
+ // from Dialog (base of TabDialog)
+ virtual short Execute();
+
// TabPageNotifiable
virtual void setInvalidPage( TabPage * pTabPage );
virtual void setValidPage( TabPage * pTabPage );
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index f915701472cb..a89e6ff478bb 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -601,6 +601,9 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
xMBroadcaster->addModifyListener( this );
#endif
+ //select chart area per default:
+ select( uno::makeAny( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) ) );
+
uno::Reference< lang::XMultiServiceFactory > xFact( m_aModel->getModel(), uno::UNO_QUERY );
if( xFact.is())
{
@@ -999,7 +1002,7 @@ namespace
{
bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
{
- if( aCommand.equals("MainTitle")
+ if( aCommand.equals("MainTitle")
|| aCommand.equals("SubTitle")
|| aCommand.equals("XTitle")
|| aCommand.equals("YTitle")
@@ -1007,7 +1010,6 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
|| aCommand.equals("SecondaryXTitle")
|| aCommand.equals("SecondaryYTitle")
|| aCommand.equals("AllTitles")
- || aCommand.equals("Legend")
|| aCommand.equals("DiagramAxisX")
|| aCommand.equals("DiagramAxisY")
|| aCommand.equals("DiagramAxisZ")
@@ -1021,9 +1023,31 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
|| aCommand.equals("DiagramGridYHelp")
|| aCommand.equals("DiagramGridZHelp")
|| aCommand.equals("DiagramGridAll")
+
|| aCommand.equals("DiagramWall")
|| aCommand.equals("DiagramFloor")
|| aCommand.equals("DiagramArea")
+ || aCommand.equals("Legend")
+
+ || aCommand.equals("FormatWall")
+ || aCommand.equals("FormatFloor")
+ || aCommand.equals("FormatChartArea")
+ || aCommand.equals("FormatLegend")
+
+ || aCommand.equals("FormatTitle")
+ || aCommand.equals("FormatAxis")
+ || aCommand.equals("FormatDataSeries")
+ || aCommand.equals("FormatDataPoint")
+ || aCommand.equals("FormatDataLabels")
+ || aCommand.equals("FormatDataLabel")
+ || aCommand.equals("FormatYErrorBars")
+ || aCommand.equals("FormatMeanValue")
+ || aCommand.equals("FormatTrendline")
+ || aCommand.equals("FormatTrendlineEquation")
+ || aCommand.equals("FormatStockLoss")
+ || aCommand.equals("FormatStockGain")
+ || aCommand.equals("FormatMajorGrid")
+ || aCommand.equals("FormatMinorGrid")
)
return true;
@@ -1089,24 +1113,28 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
else if(aCommand.equals("DiagramData"))
this->executeDispatch_EditData();
//insert objects
- else if( aCommand.equals("InsertTitle"))
- this->executeDispatch_InsertTitle();
- else if( aCommand.equals("InsertLegend"))
+ else if( aCommand.equals("InsertTitles")
+ || aCommand.equals("InsertMenuTitles") )
+ this->executeDispatch_InsertTitles();
+ else if( aCommand.equals("InsertMenuLegend") )
+ this->executeDispatch_OpenLegendDialog();
+ else if( aCommand.equals("InsertLegend") )
this->executeDispatch_InsertLegend();
- else if( aCommand.equals("InsertDescription"))
- this->executeDispatch_InsertDataLabel();
- else if( aCommand.equals("InsertAxis"))
- this->executeDispatch_InsertAxis();
- else if( aCommand.equals("InsertGrids"))
+ else if( aCommand.equals("DeleteLegend") )
+ this->executeDispatch_DeleteLegend();
+ else if( aCommand.equals("InsertMenuDataLabels"))
+ this->executeDispatch_InsertMenu_DataLabels();
+ else if( aCommand.equals("InsertMenuAxes")
+ || aCommand.equals("InsertRemoveAxes") )
+ this->executeDispatch_InsertAxes();
+ else if( aCommand.equals("InsertMenuGrids"))
this->executeDispatch_InsertGrid();
-// else if( aCommand.equals("InsertStatistics"))
-// this->executeDispatch_InsertStatistic();
- else if( aCommand.equals("InsertTrendlines"))
- this->executeDispatch_InsertTrendlines();
- else if( aCommand.equals("InsertMeanValues"))
- this->executeDispatch_InsertMeanValues();
- else if( aCommand.equals("InsertYErrorbars"))
- this->executeDispatch_InsertYErrorbars();
+ else if( aCommand.equals("InsertMenuTrendlines"))
+ this->executeDispatch_InsertMenu_Trendlines();
+ else if( aCommand.equals("InsertMenuMeanValues"))
+ this->executeDispatch_InsertMenu_MeanValues();
+ else if( aCommand.equals("InsertMenuYErrorBars"))
+ this->executeDispatch_InsertMenu_YErrorBars();
else if( aCommand.equals("InsertSymbol"))
this->executeDispatch_InsertSpecialCharacter();
else if( aCommand.equals("InsertTrendline"))
@@ -1117,14 +1145,48 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand )
this->executeDispatch_InsertMeanValue();
else if( aCommand.equals("DeleteMeanValue"))
this->executeDispatch_DeleteMeanValue();
- else if( aCommand.equals("InsertYErrorbar"))
- this->executeDispatch_InsertYErrorbar();
- else if( aCommand.equals("DeleteYErrorbar"))
- this->executeDispatch_DeleteYErrorbar();
+ else if( aCommand.equals("InsertYErrorBars"))
+ this->executeDispatch_InsertYErrorBars();
+ else if( aCommand.equals("DeleteYErrorBars"))
+ this->executeDispatch_DeleteYErrorBars();
else if( aCommand.equals("InsertTrendlineEquation"))
this->executeDispatch_InsertTrendlineEquation();
+ else if( aCommand.equals("DeleteTrendlineEquation"))
+ this->executeDispatch_DeleteTrendlineEquation();
+ else if( aCommand.equals("InsertTrendlineEquationAndR2"))
+ this->executeDispatch_InsertTrendlineEquation( true );
+ else if( aCommand.equals("InsertR2Value"))
+ this->executeDispatch_InsertR2Value();
+ else if( aCommand.equals("DeleteR2Value"))
+ this->executeDispatch_DeleteR2Value();
+ else if( aCommand.equals("InsertDataLabels") )
+ this->executeDispatch_InsertDataLabels();
+ else if( aCommand.equals("InsertDataLabel") )
+ this->executeDispatch_InsertDataLabel();
+ else if( aCommand.equals("DeleteDataLabels") )
+ this->executeDispatch_DeleteDataLabels();
+ else if( aCommand.equals("DeleteDataLabel") )
+ this->executeDispatch_DeleteDataLabel();
+ else if( aCommand.equals("ResetAllDataPoints") )
+ this->executeDispatch_ResetAllDataPoints();
+ else if( aCommand.equals("ResetDataPoint") )
+ this->executeDispatch_ResetDataPoint();
+ else if( aCommand.equals("InsertAxis") )
+ this->executeDispatch_InsertAxis();
+ else if( aCommand.equals("InsertMajorGrid") )
+ this->executeDispatch_InsertMajorGrid();
+ else if( aCommand.equals("InsertMinorGrid") )
+ this->executeDispatch_InsertMinorGrid();
+ else if( aCommand.equals("InsertAxisTitle") )
+ this->executeDispatch_InsertAxisTitle();
+ else if( aCommand.equals("DeleteAxis") )
+ this->executeDispatch_DeleteAxis();
+ else if( aCommand.equals("DeleteMajorGrid") )
+ this->executeDispatch_DeleteMajorGrid();
+ else if( aCommand.equals("DeleteMinorGrid") )
+ this->executeDispatch_DeleteMinorGrid();
//format objects
- else if( aCommand.equals("DiagramObjects"))
+ else if( aCommand.equals("FormatSelection") )
this->executeDispatch_ObjectProperties();
else if( aCommand.equals("TransformDialog"))
{
@@ -1481,15 +1543,23 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
( C2U("Cut") ) ( C2U("Copy") ) ( C2U("Paste") )
( C2U("DataRanges") ) ( C2U("DiagramData") )
// insert objects
- ( C2U("InsertTitle") ) ( C2U("InsertLegend") ) ( C2U("InsertDescription") )
- ( C2U("InsertAxis") ) ( C2U("InsertGrids") ) ( C2U("InsertStatistics") )
- ( C2U("InsertSymbol") ) ( C2U("InsertTrendline") ) ( C2U("InsertTrendlineEquation") )
- ( C2U("InsertTrendlines") ) ( C2U("InsertMeanValue") ) ( C2U("InsertMeanValues") )
- ( C2U("InsertYErrorbars") ) ( C2U("InsertYErrorbar") )
- ( C2U("DeleteTrendline") ) ( C2U("DeleteMeanValue") ) ( C2U("DeleteYErrorbar") )
+ ( C2U("InsertMenuTitles") ) ( C2U("InsertTitles") )
+ ( C2U("InsertMenuLegend") ) ( C2U("InsertLegend") ) ( C2U("DeleteLegend") )
+ ( C2U("InsertMenuDataLabels") )
+ ( C2U("InsertMenuAxes") ) ( C2U("InsertRemoveAxes") ) ( C2U("InsertMenuGrids") )
+ ( C2U("InsertSymbol") )
+ ( C2U("InsertTrendlineEquation") ) ( C2U("InsertTrendlineEquationAndR2") )
+ ( C2U("InsertR2Value") ) ( C2U("DeleteR2Value") )
+ ( C2U("InsertMenuTrendlines") ) ( C2U("InsertTrendline") )
+ ( C2U("InsertMenuMeanValues") ) ( C2U("InsertMeanValue") )
+ ( C2U("InsertMenuYErrorBars") ) ( C2U("InsertYErrorBars") )
+ ( C2U("InsertDataLabels") ) ( C2U("InsertDataLabel") )
+ ( C2U("DeleteTrendline") ) ( C2U("DeleteMeanValue") ) ( C2U("DeleteTrendlineEquation") )
+ ( C2U("DeleteYErrorBars") )
+ ( C2U("DeleteDataLabels") ) ( C2U("DeleteDataLabel") )
//format objects
//MENUCHANGE ( C2U("SelectSourceRanges") )
- ( C2U("DiagramObjects") ) ( C2U("TransformDialog") )
+ ( C2U("FormatSelection") ) ( C2U("TransformDialog") )
( C2U("DiagramType") ) ( C2U("View3D") )
( C2U("Forward") ) ( C2U("Backward") )
( C2U("MainTitle") ) ( C2U("SubTitle") )
@@ -1502,12 +1572,30 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
( C2U("DiagramGridXHelp") ) ( C2U("DiagramGridYHelp") ) ( C2U("DiagramGridZHelp") )
( C2U("DiagramGridAll") )
( C2U("DiagramWall") ) ( C2U("DiagramFloor") ) ( C2U("DiagramArea") )
+
+ //context menu - format objects entries
+ ( C2U("FormatWall") ) ( C2U("FormatFloor") ) ( C2U("FormatChartArea") )
+ ( C2U("FormatLegend") )
+
+ ( C2U("FormatAxis") ) ( C2U("FormatTitle") )
+ ( C2U("FormatDataSeries") ) ( C2U("FormatDataPoint") )
+ ( C2U("ResetAllDataPoints") ) ( C2U("ResetDataPoint") )
+ ( C2U("FormatDataLabels") ) ( C2U("FormatDataLabel") )
+ ( C2U("FormatMeanValue") ) ( C2U("FormatTrendline") ) ( C2U("FormatTrendlineEquation") )
+ ( C2U("FormatYErrorBars") )
+ ( C2U("FormatStockLoss") ) ( C2U("FormatStockGain") )
+
+ ( C2U("FormatMajorGrid") ) ( C2U("InsertMajorGrid") ) ( C2U("DeleteMajorGrid") )
+ ( C2U("FormatMinorGrid") ) ( C2U("InsertMinorGrid") ) ( C2U("DeleteMinorGrid") )
+ ( C2U("InsertAxis") ) ( C2U("DeleteAxis") ) ( C2U("InsertAxisTitle") )
+
// toolbar commands
( C2U("ToggleGridHorizontal"))( C2U("ToggleLegend") ) ( C2U("ScaleText") )
( C2U("NewArrangement") ) ( C2U("Update") )
( C2U("DefaultColors") ) ( C2U("BarWidth") ) ( C2U("NumberOfLines") )
( C2U("ArrangeRow") )
( C2U("StatusBarVisible") )
+ ( C2U("ChartElementSelector") )
;
}
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 99035429f95d..57da269fb4d7 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -610,26 +610,50 @@ private:
void SAL_CALL executeDispatch_ObjectProperties();
void SAL_CALL executeDispatch_FormatObject( const ::rtl::OUString& rDispatchCommand );
void SAL_CALL executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID );
+ bool executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso );
void SAL_CALL executeDispatch_ChartType();
- void SAL_CALL executeDispatch_InsertTitle();
- void SAL_CALL executeDispatch_InsertLegend();
- void SAL_CALL executeDispatch_InsertDataLabel();
- void SAL_CALL executeDispatch_InsertAxis();
- void SAL_CALL executeDispatch_InsertGrid();
-// void SAL_CALL executeDispatch_InsertStatistic();
- void SAL_CALL executeDispatch_InsertYErrorbars();
- void SAL_CALL executeDispatch_InsertTrendlines();
- void SAL_CALL executeDispatch_InsertMeanValue();
- void SAL_CALL executeDispatch_InsertMeanValues();
- void SAL_CALL executeDispatch_InsertTrendline();
- void SAL_CALL executeDispatch_InsertTrendlineEquation();
- void SAL_CALL executeDispatch_InsertYErrorbar();
-
- void SAL_CALL executeDispatch_DeleteMeanValue();
- void SAL_CALL executeDispatch_DeleteTrendline();
- void SAL_CALL executeDispatch_DeleteYErrorbar();
+ void executeDispatch_InsertTitles();
+ void executeDispatch_InsertLegend();
+ void executeDispatch_DeleteLegend();
+ void executeDispatch_OpenLegendDialog();
+ void executeDispatch_InsertAxes();
+ void executeDispatch_InsertGrid();
+
+ void executeDispatch_InsertMenu_DataLabels();
+ void executeDispatch_InsertMenu_YErrorBars();
+ void executeDispatch_InsertMenu_Trendlines();
+ void executeDispatch_InsertMenu_MeanValues();
+
+ void executeDispatch_InsertMeanValue();
+ void executeDispatch_InsertTrendline();
+ void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false );
+ void executeDispatch_InsertYErrorBars();
+
+ void executeDispatch_InsertR2Value();
+ void executeDispatch_DeleteR2Value();
+
+ void executeDispatch_DeleteMeanValue();
+ void executeDispatch_DeleteTrendline();
+ void executeDispatch_DeleteTrendlineEquation();
+ void executeDispatch_DeleteYErrorBars();
+
+ void executeDispatch_InsertDataLabels();
+ void executeDispatch_InsertDataLabel();
+ void executeDispatch_DeleteDataLabels();
+ void executeDispatch_DeleteDataLabel();
+
+ void executeDispatch_ResetAllDataPoints();
+ void executeDispatch_ResetDataPoint();
+
+ void executeDispatch_InsertAxis();
+ void executeDispatch_InsertAxisTitle();
+ void executeDispatch_InsertMajorGrid();
+ void executeDispatch_InsertMinorGrid();
+ void executeDispatch_DeleteAxis();
+ void executeDispatch_DeleteMajorGrid();
+ void executeDispatch_DeleteMinorGrid();
void SAL_CALL executeDispatch_InsertSpecialCharacter();
void SAL_CALL executeDispatch_EditText( const Point* pMousePixel = NULL );
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index d847965b6022..45213a4473dc 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -61,6 +61,9 @@
#include "StatisticsHelper.hxx"
#include "ErrorBarItemConverter.hxx"
#include "MultipleItemConverter.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ObjectNameProvider.hxx"
+#include "LegendHelper.hxx"
#include <com/sun/star/chart2/XRegressionCurve.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -80,6 +83,9 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
//.............................................................................
@@ -114,7 +120,7 @@ namespace chart
{
//.............................................................................
-void SAL_CALL ChartController::executeDispatch_InsertAxis()
+void ChartController::executeDispatch_InsertAxes()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -152,7 +158,7 @@ void SAL_CALL ChartController::executeDispatch_InsertAxis()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertGrid()
+void ChartController::executeDispatch_InsertGrid()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -189,7 +195,7 @@ void SAL_CALL ChartController::executeDispatch_InsertGrid()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void SAL_CALL ChartController::executeDispatch_InsertTitle()
+void ChartController::executeDispatch_InsertTitles()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -220,7 +226,29 @@ void SAL_CALL ChartController::executeDispatch_InsertTitle()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertLegend()
+void ChartController::executeDispatch_DeleteLegend()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ LegendHelper::hideLegend( m_aModel->getModel() );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertLegend()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( m_aModel->getModel(), m_xCC );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_OpenLegendDialog()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -251,13 +279,32 @@ void SAL_CALL ChartController::executeDispatch_InsertLegend()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void SAL_CALL ChartController::executeDispatch_InsertDataLabel()
+void ChartController::executeDispatch_InsertMenu_DataLabels()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
m_xUndoManager, m_aModel->getModel() );
+ //if a series is selected insert labels for that series only:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ // add labels
+ DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
+
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ rtl::OUString aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticles(
+ ObjectIdentifier::getSeriesParticleFromCID(m_aSelection.getSelectedCID()), aChildParticle );
+
+ bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true );
+ if( bSuccess )
+ aUndoGuard.commitAction();
+ return;
+ }
+
try
{
wrapper::AllDataLabelItemConverter aItemConverter(
@@ -295,11 +342,21 @@ void SAL_CALL ChartController::executeDispatch_InsertDataLabel()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertYErrorbars()
+void ChartController::executeDispatch_InsertMenu_YErrorBars()
{
+ //if a series is selected insert error bars for that series only:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is())
+ {
+ executeDispatch_InsertYErrorBars();
+ return;
+ }
+
+ //if no series is selected insert error bars for all series
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_PAGE_YERROR_BARS )))),
+ ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ),
m_xUndoManager, m_aModel->getModel() );
try
@@ -335,7 +392,7 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbars()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertMeanValue()
+void ChartController::executeDispatch_InsertMeanValue()
{
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
@@ -346,23 +403,43 @@ void SAL_CALL ChartController::executeDispatch_InsertMeanValue()
aUndoGuard.commitAction();
}
-void SAL_CALL ChartController::executeDispatch_InsertMeanValues()
+void ChartController::executeDispatch_InsertMenu_MeanValues()
{
- ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries(
- DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( m_aModel->getModel())));
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))),
m_xUndoManager, m_aModel->getModel() );
- ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC ));
+
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ //if a series is selected insert mean value only for that series:
+ lcl_InsertMeanValueLine( m_xCC ).operator()(xSeries);
+ }
+ else
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries(
+ DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( m_aModel->getModel())));
+ ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC ));
+ }
aUndoGuard.commitAction();
}
-void SAL_CALL ChartController::executeDispatch_InsertTrendlines()
+void ChartController::executeDispatch_InsertMenu_Trendlines()
{
+ //if a series is selected insert only for that series:
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is())
+ {
+ executeDispatch_InsertTrendline();
+ return;
+ }
+
UndoGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVES )))),
+ ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ),
m_xUndoManager, m_aModel->getModel() );
try
@@ -395,7 +472,7 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendlines()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertTrendline()
+void ChartController::executeDispatch_InsertTrendline()
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
@@ -449,7 +526,7 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendline()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertYErrorbar()
+void ChartController::executeDispatch_InsertYErrorBars()
{
uno::Reference< chart2::XDataSeries > xSeries(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
@@ -457,7 +534,7 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbar()
{
UndoLiveUpdateGuard aUndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_INDICATOR )))),
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))),
m_xUndoManager, m_aModel->getModel() );
// add error bars with standard deviation
@@ -499,10 +576,16 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbar()
}
}
-void SAL_CALL ChartController::executeDispatch_InsertTrendlineEquation()
+void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 )
{
uno::Reference< chart2::XRegressionCurve > xRegCurve(
ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( !xRegCurve.is() )
+ {
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ xRegCurve.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
+ }
if( xRegCurve.is())
{
uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties());
@@ -514,13 +597,43 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendlineEquation()
ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
m_xUndoManager, m_aModel->getModel() );
xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true ));
- xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 ));
aUndoGuard.commitAction();
}
}
}
-void SAL_CALL ChartController::executeDispatch_DeleteMeanValue()
+void ChartController::executeDispatch_InsertR2Value()
+{
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xEqProp.is())
+ {
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, m_aModel->getModel() );
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true ));
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteR2Value()
+{
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xEqProp.is())
+ {
+ UndoGuard aUndoGuard = UndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, m_aModel->getModel() );
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteMeanValue()
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
@@ -535,7 +648,7 @@ void SAL_CALL ChartController::executeDispatch_DeleteMeanValue()
}
}
-void SAL_CALL ChartController::executeDispatch_DeleteTrendline()
+void ChartController::executeDispatch_DeleteTrendline()
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
@@ -550,7 +663,22 @@ void SAL_CALL ChartController::executeDispatch_DeleteTrendline()
}
}
-void SAL_CALL ChartController::executeDispatch_DeleteYErrorbar()
+void ChartController::executeDispatch_DeleteTrendlineEquation()
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xRegCurveCnt.is())
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))),
+ m_xUndoManager, m_aModel->getModel());
+ RegressionCurveHelper::removeEquations( xRegCurveCnt );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteYErrorBars()
{
uno::Reference< chart2::XDataSeries > xDataSeries(
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()));
@@ -565,6 +693,256 @@ void SAL_CALL ChartController::executeDispatch_DeleteYErrorbar()
}
}
+void ChartController::executeDispatch_InsertDataLabels()
+{
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, m_aModel->getModel() );
+ DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_InsertDataLabel()
+{
+ UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
+ m_xUndoManager, m_aModel->getModel() );
+ DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel() ) );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_DeleteDataLabels()
+{
+ uno::Reference< chart2::XDataSeries > xSeries(
+ ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))),
+ m_xUndoManager, m_aModel->getModel());
+ DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries );
+ aUndoGuard.commitAction();
+ }
+}
+
+void ChartController::executeDispatch_DeleteDataLabel()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))),
+ m_xUndoManager, m_aModel->getModel());
+ DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel() ) );
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_ResetAllDataPoints()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINTS )))),
+ m_xUndoManager, m_aModel->getModel());
+ uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ xSeries->resetAllDataPoints();
+ aUndoGuard.commitAction();
+}
+void ChartController::executeDispatch_ResetDataPoint()
+{
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT,
+ ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINT )))),
+ m_xUndoManager, m_aModel->getModel());
+ uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY );
+ if( xSeries.is() )
+ {
+ sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
+ xSeries->resetDataPoint( nPointIndex );
+ }
+ aUndoGuard.commitAction();
+}
+
+void ChartController::executeDispatch_InsertAxisTitle()
+{
+ try
+ {
+ uno::Reference< XTitle > xTitle;
+ {
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram(m_aModel->getModel()), nCooSysIndex, nDimensionIndex, nAxisIndex );
+
+ TitleHelper::eTitleType eTitleType = TitleHelper::X_AXIS_TITLE;
+ if( nDimensionIndex==0 )
+ eTitleType = nAxisIndex==0 ? TitleHelper::X_AXIS_TITLE : TitleHelper::SECONDARY_X_AXIS_TITLE;
+ else if( nDimensionIndex==1 )
+ eTitleType = nAxisIndex==0 ? TitleHelper::Y_AXIS_TITLE : TitleHelper::SECONDARY_Y_AXIS_TITLE;
+ else
+ eTitleType = TitleHelper::Z_AXIS_TITLE;
+
+ ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider());
+ xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), m_aModel->getModel(), m_xCC, apRefSizeProvider.get() );
+ aUndoGuard.commitAction();
+ }
+
+ /*
+ if( xTitle.is() )
+ {
+ OUString aTitleCID = ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_aModel->getModel() );
+ select( uno::makeAny(aTitleCID) );
+ executeDispatch_EditText();
+ }
+ */
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertAxis()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeAxisVisible( xAxis );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteAxis()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeAxisInvisible( xAxis );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMajorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeGridVisible( xAxis->getGridProperties() );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteMajorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ AxisHelper::makeGridInvisible( xAxis->getGridProperties() );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_InsertMinorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridVisible( aSubGrids[nN] );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void ChartController::executeDispatch_DeleteMinorGrid()
+{
+ UndoGuard aUndoGuard(
+ ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ try
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() )
+ {
+ Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
+ for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++)
+ AxisHelper::makeGridInvisible( aSubGrids[nN] );
+ aUndoGuard.commitAction();
+ }
+ }
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
//.............................................................................
} //namespace chart
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 530cd6f0aeb8..754e66ec7d17 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -62,6 +62,7 @@
#include "ResId.hxx"
#include "Strings.hrc"
#include "ReferenceSizeProvider.hxx"
+#include "RegressionCurveHelper.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
//for auto_ptr
@@ -80,6 +81,8 @@ namespace chart
//.............................................................................
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
namespace
{
@@ -437,34 +440,37 @@ rtl::OUString lcl_getGridCIDForCommand( const ::rtl::OString& rDispatchCommand,
rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) );
return aCID;
}
-rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument )
+rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument, const rtl::OUString& rSelectedCID )
{
ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
rtl::OUString aParticleID;
uno::Reference< frame::XModel > xChartModel( xChartDocument, uno::UNO_QUERY );
+ const ObjectType eSelectedType = ObjectIdentifier::getObjectType( rSelectedCID );
+ uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartModel );
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xSeries, uno::UNO_QUERY );
//-------------------------------------------------------------------------
//legend
- if( rDispatchCommand.equals("Legend"))
+ if( rDispatchCommand.equals("Legend") || rDispatchCommand.equals("FormatLegend") )
{
eObjectType = OBJECTTYPE_LEGEND;
//@todo set particular aParticleID if we have more than one legend
}
//-------------------------------------------------------------------------
//wall floor area
- else if( rDispatchCommand.equals("DiagramWall"))
+ else if( rDispatchCommand.equals("DiagramWall") || rDispatchCommand.equals("FormatWall") )
{
//OBJECTTYPE_DIAGRAM;
eObjectType = OBJECTTYPE_DIAGRAM_WALL;
//@todo set particular aParticleID if we have more than one diagram
}
- else if( rDispatchCommand.equals("DiagramFloor"))
+ else if( rDispatchCommand.equals("DiagramFloor") || rDispatchCommand.equals("FormatFloor") )
{
eObjectType = OBJECTTYPE_DIAGRAM_FLOOR;
//@todo set particular aParticleID if we have more than one diagram
}
- else if( rDispatchCommand.equals("DiagramArea"))
+ else if( rDispatchCommand.equals("DiagramArea") || rDispatchCommand.equals("FormatChartArea") )
{
eObjectType = OBJECTTYPE_PAGE;
}
@@ -507,6 +513,163 @@ rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand
{
return lcl_getGridCIDForCommand( rDispatchCommand, xChartModel );
}
+ //-------------------------------------------------------------------------
+ //data series
+ else if( rDispatchCommand.equals("FormatDataSeries") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_SERIES )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_DATA_SERIES, ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ) );
+ }
+ //-------------------------------------------------------------------------
+ //data point
+ else if( rDispatchCommand.equals("FormatDataPoint") )
+ {
+ return rSelectedCID;
+ }
+ //-------------------------------------------------------------------------
+ //data labels
+ else if( rDispatchCommand.equals("FormatDataLabels") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_LABELS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_LABELS, ::rtl::OUString(), rSelectedCID );
+ }
+ //-------------------------------------------------------------------------
+ //data labels
+ else if( rDispatchCommand.equals("FormatDataLabel") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_LABEL )
+ return rSelectedCID;
+ else
+ {
+ sal_Int32 nPointIndex = ObjectIdentifier::getParticleID( rSelectedCID ).toInt32();
+ if( nPointIndex>=0 )
+ {
+ OUString aSeriesParticle = ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID );
+ OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ OUString aLabelsCID = ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle );
+ OUString aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_LABEL, ::rtl::OUString(), aLabelsCID );
+
+ return ObjectIdentifier::createPointCID( aLabelCID_Stub, nPointIndex );
+ }
+ }
+ }
+ //-------------------------------------------------------------------------
+ //mean value line
+ else if( rDispatchCommand.equals("FormatMeanValue") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_AVERAGE_LINE )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getMeanValueLine( xRegCurveCnt ) ), true );
+ }
+ //-------------------------------------------------------------------------
+ //trend line
+ else if( rDispatchCommand.equals("FormatTrendline") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_CURVE )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ), false );
+ }
+ //-------------------------------------------------------------------------
+ //trend line equation
+ else if( rDispatchCommand.equals("FormatTrendlineEquation") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createDataCurveEquationCID(
+ ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
+ RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt,
+ RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ) );
+ }
+ //-------------------------------------------------------------------------
+ // y error bars
+ else if( rDispatchCommand.equals("FormatYErrorBars") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_ERRORS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS, ::rtl::OUString(), rSelectedCID );
+ }
+ //-------------------------------------------------------------------------
+ // axis
+ else if( rDispatchCommand.equals("FormatAxis") )
+ {
+ if( eSelectedType == OBJECTTYPE_AXIS )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis , xChartModel );
+ }
+ }
+ //-------------------------------------------------------------------------
+ // major grid
+ else if( rDispatchCommand.equals("FormatMajorGrid") )
+ {
+ if( eSelectedType == OBJECTTYPE_GRID )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel );
+ }
+
+ }
+ //-------------------------------------------------------------------------
+ // minor grid
+ else if( rDispatchCommand.equals("FormatMinorGrid") )
+ {
+ if( eSelectedType == OBJECTTYPE_SUBGRID )
+ return rSelectedCID;
+ else
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel );
+ return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, 0 /*sub grid index*/ );
+ }
+ }
+ //-------------------------------------------------------------------------
+ // title
+ else if( rDispatchCommand.equals("FormatTitle") )
+ {
+ if( eSelectedType == OBJECTTYPE_TITLE )
+ return rSelectedCID;
+ }
+ //-------------------------------------------------------------------------
+ // stock loss
+ else if( rDispatchCommand.equals("FormatStockLoss") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_STOCK_LOSS )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_LOSS, rtl::OUString());
+ }
+ //-------------------------------------------------------------------------
+ // stock gain
+ else if( rDispatchCommand.equals("FormatStockGain") )
+ {
+ if( eSelectedType == OBJECTTYPE_DATA_STOCK_GAIN )
+ return rSelectedCID;
+ else
+ return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_GAIN, rtl::OUString() );
+ }
+
return ObjectIdentifier::createClassifiedIdentifier(
eObjectType, aParticleID );
}
@@ -518,7 +681,7 @@ void SAL_CALL ChartController::executeDispatch_FormatObject(const ::rtl::OUStrin
{
uno::Reference< XChartDocument > xChartDocument( m_aModel->getModel(), uno::UNO_QUERY );
rtl::OString aCommand( rtl::OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) );
- rtl::OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument );
+ rtl::OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument, m_aSelection.getSelectedCID() );
executeDlg_ObjectProperties( rObjectCID );
}
@@ -527,56 +690,74 @@ void SAL_CALL ChartController::executeDispatch_ObjectProperties()
executeDlg_ObjectProperties( m_aSelection.getSelectedCID() );
}
-void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID )
+namespace
+{
+
+rtl::OUString lcl_getFormatCIDforSelectedCID( const ::rtl::OUString& rSelectedCID )
+{
+ ::rtl::OUString aFormatCID(rSelectedCID);
+
+ //get type of selected object
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( aFormatCID );
+
+ // some legend entries are handled as if they were data series
+ if( OBJECTTYPE_LEGEND_ENTRY==eObjectType )
+ {
+ rtl::OUString aParentParticle( ObjectIdentifier::getFullParentParticle( rSelectedCID ) );
+ aFormatCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
+ }
+
+ // treat diagram as wall
+ if( OBJECTTYPE_DIAGRAM==eObjectType )
+ aFormatCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() );
+
+ return aFormatCID;
+}
+
+}//end anonymous namespace
+
+void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUString& rSelectedObjectCID )
+{
+ rtl::OUString aObjectCID = lcl_getFormatCIDforSelectedCID( rSelectedObjectCID );
+
+ UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription(
+ ActionDescriptionProvider::FORMAT,
+ ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
+ m_xUndoManager, m_aModel->getModel() );
+
+ bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false );
+ if( bSuccess )
+ aUndoGuard.commitAction();
+}
+
+bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso )
{
+ //return true if the properties were changed successfully
+ bool bRet = false;
if( !rObjectCID.getLength() )
{
//DBG_ERROR("empty ObjectID");
- return;
+ return bRet;
}
try
{
- ::rtl::OUString aObjectCID(rObjectCID);
NumberFormatterWrapper aNumberFormatterWrapper( uno::Reference< util::XNumberFormatsSupplier >(m_aModel->getModel(), uno::UNO_QUERY) );
//-------------------------------------------------------------
- //get type of selected object
- ObjectType eObjectType = ObjectIdentifier::getObjectType( aObjectCID );
+ //get type of object
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
if( OBJECTTYPE_UNKNOWN==eObjectType )
{
//DBG_ERROR("unknown ObjectType");
- return;
- }
-
- // some legend entries are handled as if they were data series
- if( OBJECTTYPE_LEGEND_ENTRY==eObjectType )
- {
- rtl::OUString aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ) );
- eObjectType = ObjectIdentifier::getObjectType( aParentParticle );
- aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
+ return bRet;
}
-
- // treat diagram as wall
- if( OBJECTTYPE_DIAGRAM==eObjectType )
- {
- aObjectCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() );
- eObjectType = OBJECTTYPE_DIAGRAM_WALL;
- }
-
if( OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType )
{
if( !DiagramHelper::isSupportingFloorAndWall( ChartModelHelper::findDiagram( m_aModel->getModel() ) ) )
- return;
+ return bRet;
}
//-------------------------------------------------------------
- UndoGuard aUndoGuard(
- ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::FORMAT,
- ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))),
- m_xUndoManager, m_aModel->getModel() );
-
- //-------------------------------------------------------------
//convert properties to ItemSet
awt::Size aPageSize( ChartModelHelper::getPageSize(m_aModel->getModel()) );
@@ -584,20 +765,20 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin
::std::auto_ptr< ReferenceSizeProvider > pRefSizeProv(
impl_createReferenceSizeProvider());
::std::auto_ptr< ::comphelper::ItemConverter > apItemConverter(
- createItemConverter( aObjectCID, m_aModel->getModel(), m_xCC,
+ createItemConverter( rObjectCID, m_aModel->getModel(), m_xCC,
m_pDrawModelWrapper->getSdrModel(),
&aNumberFormatterWrapper,
ExplicitValueProvider::getExplicitValueProvider(m_xChartView),
pRefSizeProv ));
if(!apItemConverter.get())
- return;
+ return bRet;
SfxItemSet aItemSet = apItemConverter->CreateEmptyItemSet();
apItemConverter->FillItemSet( aItemSet );
//-------------------------------------------------------------
//prepare dialog
- ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( aObjectCID );
+ ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( rObjectCID );
aDialogParameter.init( m_aModel->getModel() );
ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() );
@@ -609,9 +790,9 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin
{
SfxItemSet* pSymbolShapeProperties=NULL;
uno::Reference< beans::XPropertySet > xObjectProperties =
- ObjectIdentifier::getObjectPropertySet( aObjectCID, m_aModel->getModel() );
+ ObjectIdentifier::getObjectPropertySet( rObjectCID, m_aModel->getModel() );
wrapper::DataPointItemConverter aSymbolItemConverter( m_aModel->getModel(), m_xCC
- , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( aObjectCID, m_aModel->getModel() )
+ , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, m_aModel->getModel() )
, m_pDrawModelWrapper->getSdrModel().GetItemPool()
, m_pDrawModelWrapper->getSdrModel()
, &aNumberFormatterWrapper
@@ -629,24 +810,19 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin
if( aDialogParameter.HasStatisticProperties() )
{
aDlg.SetAxisMinorStepWidthForErrorBarDecimals(
- InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( m_aModel->getModel(), m_xChartView, aObjectCID ) );
+ InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( m_aModel->getModel(), m_xChartView, rObjectCID ) );
}
//-------------------------------------------------------------
//open the dialog
- if( aDlg.Execute() == RET_OK )
+ if( aDlg.Execute() == RET_OK || (bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso && aDlg.DialogWasClosedWithOK()) )
{
const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet();
if(pOutItemSet)
{
- bool bChanged = false;
- {
- ControllerLockGuard aCLGuard( m_aModel->getModel());
- bChanged = apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now
- }
-
- if( bChanged )
- aUndoGuard.commitAction();
+ ControllerLockGuard aCLGuard( m_aModel->getModel());
+ apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now
+ bRet = true;
}
}
}
@@ -656,6 +832,7 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin
catch( uno::RuntimeException& )
{
}
+ return bRet;
}
void SAL_CALL ChartController::executeDispatch_View3D()
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 6a991b01ee3c..c3d88bfb86fa 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -745,7 +745,7 @@ bool ChartController::executeDispatch_Delete()
// using assignment for broken gcc 3.3
UndoGuard aUndoGuard = UndoGuard(
ActionDescriptionProvider::createDescription(
- ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_INDICATOR )))),
+ ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))),
m_xUndoManager, xModel );
{
ControllerLockGuard aCtlLockGuard( xModel );
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index 92ee30cacfd2..8dc4a6148346 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -51,11 +51,19 @@
#include "chartview/ExplicitValueProvider.hxx"
#include "RelativePositionHelper.hxx"
#include "chartview/DrawModelWrapper.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "StatisticsHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisHelper.hxx"
+#include "LegendHelper.hxx"
+#include "servicenames_charttypes.hxx"
#include "MenuResIds.hrc"
#include "DrawCommandDispatch.hxx"
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/frame/XDispatchHelper.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -87,6 +95,13 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
namespace
{
@@ -140,13 +155,86 @@ void lcl_insertMenuCommand(
xMenuEx->setCommand( nId, rCommand );
}
-} // anonymous namespace
+OUString lcl_getFormatCommandForObjectCID( const OUString& rCID )
+{
+ OUString aDispatchCommand( C2U(".uno:FormatSelection") );
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID );
-//.............................................................................
-namespace chart
-{
-//.............................................................................
+ switch(eObjectType)
+ {
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ aDispatchCommand = C2U(".uno:FormatWall");
+ break;
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ aDispatchCommand = C2U(".uno:FormatFloor");
+ break;
+ case OBJECTTYPE_PAGE:
+ aDispatchCommand = C2U(".uno:FormatChartArea");
+ break;
+ case OBJECTTYPE_LEGEND:
+ aDispatchCommand = C2U(".uno:FormatLegend");
+ break;
+ case OBJECTTYPE_TITLE:
+ aDispatchCommand = C2U(".uno:FormatTitle");
+ break;
+ case OBJECTTYPE_LEGEND_ENTRY:
+ aDispatchCommand = C2U(".uno:FormatDataSeries");
+ break;
+ case OBJECTTYPE_AXIS:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ aDispatchCommand = C2U(".uno:FormatAxis");
+ break;
+ case OBJECTTYPE_GRID:
+ aDispatchCommand = C2U(".uno:FormatMajorGrid");
+ break;
+ case OBJECTTYPE_SUBGRID:
+ aDispatchCommand = C2U(".uno:FormatMinorGrid");
+ break;
+ case OBJECTTYPE_DATA_LABELS:
+ aDispatchCommand = C2U(".uno:FormatDataLabels");
+ break;
+ case OBJECTTYPE_DATA_SERIES:
+ aDispatchCommand = C2U(".uno:FormatDataSeries");
+ break;
+ case OBJECTTYPE_DATA_LABEL:
+ aDispatchCommand = C2U(".uno:FormatDataLabel");
+ break;
+ case OBJECTTYPE_DATA_POINT:
+ aDispatchCommand = C2U(".uno:FormatDataPoint");
+ break;
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ aDispatchCommand = C2U(".uno:FormatMeanValue");
+ break;
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ aDispatchCommand = C2U(".uno:FormatYErrorBars");
+ break;
+ case OBJECTTYPE_DATA_CURVE:
+ aDispatchCommand = C2U(".uno:FormatTrendline");
+ break;
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ aDispatchCommand = C2U(".uno:FormatTrendlineEquation");
+ break;
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ aDispatchCommand = C2U(".uno:FormatSelection");
+ break;
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ aDispatchCommand = C2U(".uno:FormatStockLoss");
+ break;
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ aDispatchCommand = C2U(".uno:FormatStockGain");
+ break;
+ default: //OBJECTTYPE_UNKNOWN
+ break;
+ }
+ return aDispatchCommand;
+}
+
+} // anonymous namespace
const short HITPIX=2; //hit-tolerance in pixel
@@ -900,103 +988,321 @@ void ChartController::execute_LoseFocus()
//this->ReleaseMouse();
}
-void ChartController::execute_Command( const CommandEvent& rCEvt )
-{
- Window* pWindow = m_pChartWindow;
-
- bool bIsAction = false;
- {
- ::vos::OGuard aGuard( Application::GetSolarMutex());
- DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
- if(!pWindow || !pDrawViewWrapper)
- return;
- bIsAction = m_pDrawViewWrapper->IsAction();
- }
-
- // pop-up menu
- if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
- {
- m_pChartWindow->ReleaseMouse();
-
- if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
- impl_notifySelectionChangeListeners();
-
- if ( isShapeContext() )
- {
- // #i12587# support for shapes in chart
- PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ?
- RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) );
- ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
- Point aPos( rCEvt.GetMousePosPixel() );
- if( !rCEvt.IsMouseEvent() )
- {
- aPos = m_pChartWindow->GetPointerState().maPos;
- }
- aContextMenuHelper.completeAndExecute( aPos, aContextMenu );
- }
- else
- {
- // todo: the context menu should be specified by an xml file in uiconfig
- uno::Reference< awt::XPopupMenu > xPopupMenu(
- m_xCC->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
- uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY );
- if( xPopupMenu.is() && xMenuEx.is())
- {
- sal_Int16 nUniqueId = 1;
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramObjects"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow"));
- uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
- m_xCC->getServiceManager()->createInstanceWithContext(
- C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
- uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY );
- if( xArrangePopupMenu.is() && xArrangeMenuEx.is())
- {
- sal_Int16 nSubId = nUniqueId + 1;
- lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward"));
- lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward"));
- xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
- nUniqueId = nSubId;
- }
- ++nUniqueId;
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D"));
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData"));
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorbar"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorbar"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation"));
- xPopupMenu->insertSeparator( -1 );
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy"));
- lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste"));
-
- ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
- Point aPos( rCEvt.GetMousePosPixel() );
- if( !rCEvt.IsMouseEvent() )
- aPos = m_pChartWindow->GetPointerState().maPos;
- aContextMenuHelper.completeAndExecute( aPos, xPopupMenu );
- }
- }
- }
- else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) ||
- ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) ||
- ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) ||
- ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) )
- {
- //#i84417# enable editing with IME
- if( m_pDrawViewWrapper )
- m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
- }
-}
+void ChartController::execute_Command( const CommandEvent& rCEvt )
+{
+ Window* pWindow = m_pChartWindow;
+
+ bool bIsAction = false;
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex());
+ DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+ if(!pWindow || !pDrawViewWrapper)
+ return;
+ bIsAction = m_pDrawViewWrapper->IsAction();
+ }
+
+ // pop-up menu
+ if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction)
+ {
+ m_pChartWindow->ReleaseMouse();
+
+ if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() )
+ impl_notifySelectionChangeListeners();
+
+ if ( isShapeContext() )
+ {
+ // #i12587# support for shapes in chart
+ PopupMenu aContextMenu( SchResId( m_pDrawViewWrapper->IsTextEdit() ?
+ RID_CONTEXTMENU_SHAPEEDIT : RID_CONTEXTMENU_SHAPE ) );
+ ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
+ Point aPos( rCEvt.GetMousePosPixel() );
+ if( !rCEvt.IsMouseEvent() )
+ {
+ aPos = m_pChartWindow->GetPointerState().maPos;
+ }
+ aContextMenuHelper.completeAndExecute( aPos, aContextMenu );
+ }
+ else
+ {
+ // todo: the context menu should be specified by an xml file in uiconfig
+ uno::Reference< awt::XPopupMenu > xPopupMenu(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
+ uno::Reference< awt::XMenuExtended > xMenuEx( xPopupMenu, uno::UNO_QUERY );
+ if( xPopupMenu.is() && xMenuEx.is())
+ {
+ sal_Int16 nUniqueId = 1;
+ ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() );
+ Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_aModel->getModel() );
+
+ OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand );
+
+ //some commands for dataseries and points:
+ //-----
+ if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType )
+ {
+ bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType );
+ uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) );
+ bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline );
+ Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) );
+ bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true );
+ bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries );
+ bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries );
+ bool bHasDataLabelAtPoint = false;
+ sal_Int32 nPointIndex = -1;
+ if( bIsPoint )
+ {
+ nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() );
+ bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex );
+ }
+ bool bSelectedPointIsFormatted = false;
+ bool bHasFormattedDataPointsOtherThanSelected = false;
+
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ if( aAttributedDataPointIndexList.hasElements() )
+ {
+ if( bIsPoint )
+ {
+ ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
+ ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
+ if( aIt != aIndices.end())
+ bSelectedPointIsFormatted = true;
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
+ }
+ else
+ bHasFormattedDataPointsOtherThanSelected = true;
+ }
+ }
+ }
+
+ //const sal_Int32 nIdBeforeFormat = nUniqueId;
+ if( bIsPoint )
+ {
+ if( bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") );
+ if( !bHasDataLabelAtPoint )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") );
+ else
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") );
+ if( bSelectedPointIsFormatted )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint"));
+
+ xPopupMenu->insertSeparator( -1 );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") );
+ }
+
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
+ if( xChartTypeProp.is() )
+ {
+ bool bJapaneseStyle = false;
+ xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle;
+
+ if( bJapaneseStyle )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
+ }
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ if( bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") );
+ if( xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") );
+
+ //if( nIdBeforeFormat != nUniqueId )
+ xPopupMenu->insertSeparator( -1 );
+
+ //const sal_Int32 nIdBeforeInsert = nUniqueId;
+
+ if( !bHasDataLabelsAtSeries )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") );
+ if( !xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") );
+ else if( !bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
+ if( !xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") );
+ if( !bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") );
+
+ //if( nIdBeforeInsert != nUniqueId )
+ // xPopupMenu->insertSeparator( -1 );
+
+ //const sal_Int32 nIdBeforeDelete = nUniqueId;
+
+ if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") );
+ if( xTrendline.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") );
+ if( bHasEquation )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
+ if( xMeanValue.is() )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") );
+ if( bHasYErrorBars )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") );
+
+ if( bHasFormattedDataPointsOtherThanSelected )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints"));
+
+ //if( nIdBeforeDelete != nUniqueId )
+ xPopupMenu->insertSeparator( -1 );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow"));
+ uno::Reference< awt::XPopupMenu > xArrangePopupMenu(
+ m_xCC->getServiceManager()->createInstanceWithContext(
+ C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY );
+ uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY );
+ if( xArrangePopupMenu.is() && xArrangeMenuEx.is())
+ {
+ sal_Int16 nSubId = nUniqueId + 1;
+ lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") );
+ lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") );
+ xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu );
+ nUniqueId = nSubId;
+ }
+ ++nUniqueId;
+ }
+ else if( OBJECTTYPE_DATA_CURVE == eObjectType )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
+ }
+ else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType )
+ {
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") );
+ }
+
+ //some commands for axes: and grids
+ //-----
+ else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType )
+ {
+ Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() );
+ if( xAxis.is() && xDiagram.is() )
+ {
+ sal_Int32 nDimensionIndex = -1;
+ sal_Int32 nCooSysIndex = -1;
+ sal_Int32 nAxisIndex = -1;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
+ bool bIsSecondaryAxis = nAxisIndex!=0;
+ bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis );
+ bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram );
+ bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram );
+ bool bHasTitle = false;
+ uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY );
+ if( xTitled.is())
+ bHasTitle = TitleHelper::getCompleteString( xTitled->getTitleObject() ).getLength()>0;
+
+ if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") );
+ if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") );
+ if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") );
+
+ xPopupMenu->insertSeparator( -1 );
+
+ if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") );
+ if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") );
+ if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") );
+ if( !bHasTitle )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") );
+
+ if( bIsAxisVisible )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") );
+ if( bIsMajorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") );
+ if( bIsMinorGridVisible && !bIsSecondaryAxis )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") );
+ }
+ }
+
+ if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") );
+ else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") );
+
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog"));
+
+ if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType
+ || OBJECTTYPE_DIAGRAM_WALL == eObjectType
+ || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType
+ || OBJECTTYPE_UNKNOWN == eObjectType )
+ {
+ if( OBJECTTYPE_UNKNOWN != eObjectType )
+ xPopupMenu->insertSeparator( -1 );
+ bool bHasLegend = LegendHelper::hasLegend( xDiagram );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") );
+ if( !bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") );
+ if( bHasLegend )
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") );
+ }
+ //-----
+
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D"));
+ xPopupMenu->insertSeparator( -1 );
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy"));
+ lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Paste"));
+
+ ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame );
+ Point aPos( rCEvt.GetMousePosPixel() );
+ if( !rCEvt.IsMouseEvent() )
+ aPos = m_pChartWindow->GetPointerState().maPos;
+ aContextMenuHelper.completeAndExecute( aPos, xPopupMenu );
+ }
+ }
+ }
+ else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) ||
+ ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) )
+ {
+ //#i84417# enable editing with IME
+ if( m_pDrawViewWrapper )
+ m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow );
+ }
+}
bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
{
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index e94cca83d673..978cc421dad2 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -121,7 +121,7 @@ struct ControllerState
// -- State variables -------
bool bHasSelectedObject;
- bool bIsDraggableObject;
+ bool bIsPositionableObject;
bool bIsTextObject;
bool bIsDeleteableObjectSelected;
bool bIsFormateableObjectSelected;
@@ -134,18 +134,26 @@ struct ControllerState
// trendlines
bool bMayAddTrendline;
bool bMayAddTrendlineEquation;
+ bool bMayAddR2Value;
bool bMayAddMeanValue;
bool bMayAddYErrorBars;
bool bMayDeleteTrendline;
+ bool bMayDeleteTrendlineEquation;
+ bool bMayDeleteR2Value;
bool bMayDeleteMeanValue;
bool bMayDeleteYErrorBars;
+
+ bool bMayFormatTrendline;
+ bool bMayFormatTrendlineEquation;
+ bool bMayFormatMeanValue;
+ bool bMayFormatYErrorBars;
};
ControllerState::ControllerState() :
bHasSelectedObject( false ),
- bIsDraggableObject( false ),
+ bIsPositionableObject( false ),
bIsTextObject(false),
bIsDeleteableObjectSelected(false),
bIsFormateableObjectSelected(false),
@@ -153,11 +161,18 @@ ControllerState::ControllerState() :
bMayMoveSeriesBackward( false ),
bMayAddTrendline( false ),
bMayAddTrendlineEquation( false ),
+ bMayAddR2Value( false ),
bMayAddMeanValue( false ),
bMayAddYErrorBars( false ),
bMayDeleteTrendline( false ),
+ bMayDeleteTrendlineEquation( false ),
+ bMayDeleteR2Value( false ),
bMayDeleteMeanValue( false ),
- bMayDeleteYErrorBars( false )
+ bMayDeleteYErrorBars( false ),
+ bMayFormatTrendline( false ),
+ bMayFormatTrendlineEquation( false ),
+ bMayFormatMeanValue( false ),
+ bMayFormatYErrorBars( false )
{}
void ControllerState::update(
@@ -176,9 +191,9 @@ void ControllerState::update(
bHasSelectedObject = aSelOID.isValid();
- bIsDraggableObject = aSelOID.isDragableObject();
-
ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID ));
+
+ bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && aSelOID.isDragableObject();
bIsTextObject = OBJECTTYPE_TITLE == aObjectType;
uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
@@ -192,23 +207,30 @@ void ControllerState::update(
bIsDeleteableObjectSelected = ChartController::isObjectDeleteable( aSelObj );
- bMayMoveSeriesForward = DiagramHelper::isSeriesMoveable(
+ bMayMoveSeriesForward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
ChartModelHelper::findDiagram( xModel ),
xGivenDataSeries,
MOVE_SERIES_FORWARD );
- bMayMoveSeriesBackward = DiagramHelper::isSeriesMoveable(
+ bMayMoveSeriesBackward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable(
ChartModelHelper::findDiagram( xModel ),
xGivenDataSeries,
MOVE_SERIES_BACKWARD );
bMayAddTrendline = false;
bMayAddTrendlineEquation = false;
+ bMayAddR2Value = false;
bMayAddMeanValue = false;
bMayAddYErrorBars = false;
bMayDeleteTrendline = false;
+ bMayDeleteTrendlineEquation = false;
+ bMayDeleteR2Value = false;
bMayDeleteMeanValue = false;
bMayDeleteYErrorBars = false;
+ bMayFormatTrendline = false;
+ bMayFormatTrendlineEquation = false;
+ bMayFormatMeanValue = false;
+ bMayFormatYErrorBars = false;
if( bHasSelectedObject )
{
if( xGivenDataSeries.is())
@@ -218,46 +240,63 @@ void ControllerState::update(
DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram ));
// trend lines/mean value line
- if( ChartTypeHelper::isSupportingRegressionProperties(
- xFirstChartType, nDimensionCount ))
+ if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
+ && ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount ))
{
uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
xGivenDataSeries, uno::UNO_QUERY );
if( xRegCurveCnt.is())
{
- bMayDeleteTrendline = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ).is();
- bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
+ uno::Reference< chart2::XRegressionCurve > xRegCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) );
+ bMayFormatTrendline = bMayDeleteTrendline = xRegCurve.is();
+ bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt );
bMayAddTrendline = ! bMayDeleteTrendline;
bMayAddMeanValue = ! bMayDeleteMeanValue;
+ bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
+ bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
}
}
// error bars
- if( ChartTypeHelper::isSupportingStatisticProperties(
- xFirstChartType, nDimensionCount ))
+ if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType)
+ && ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount ))
{
- bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries );
+ bMayFormatYErrorBars = bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries );
bMayAddYErrorBars = ! bMayDeleteYErrorBars;
}
}
+ if( aObjectType == OBJECTTYPE_DATA_AVERAGE_LINE )
+ bMayFormatMeanValue = true;
+
+ if( aObjectType == OBJECTTYPE_DATA_ERRORS_Y || aObjectType == OBJECTTYPE_DATA_ERRORS )
+ bMayFormatYErrorBars = true;
+
if( aObjectType == OBJECTTYPE_DATA_CURVE )
{
+ bMayFormatTrendline = true;
uno::Reference< chart2::XRegressionCurve > xRegCurve(
ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
- if( xRegCurve.is())
+ bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve );
+ bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation;
+ }
+ else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
+ {
+ bMayFormatTrendlineEquation = true;
+ bool bHasR2Value = false;
+ try
{
- uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties());
- bool bShowEq = false;
- bool bShowCorr = false;
+ uno::Reference< beans::XPropertySet > xEqProp(
+ ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY );
if( xEqProp.is())
- {
- xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq;
- xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCorr;
-
- bMayAddTrendlineEquation = ! (bShowEq || bShowCorr);
- }
+ xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient") ) >>= bHasR2Value;
}
+ catch( uno::RuntimeException& e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ bMayAddR2Value = !bHasR2Value;
+ bMayDeleteR2Value = bHasR2Value;
}
}
}
@@ -509,33 +548,53 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ C2U(".uno:DefaultColors")] = bIsWritable;
m_aCommandAvailability[ C2U(".uno:BarWidth")] = bIsWritable;
m_aCommandAvailability[ C2U(".uno:NumberOfLines")] = bIsWritable;
- m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward;
// insert objects
- m_aCommandAvailability[ C2U(".uno:InsertTitle")] = bIsWritable;
- m_aCommandAvailability[ C2U(".uno:InsertLegend")] = bIsWritable;
- m_aCommandAvailability[ C2U(".uno:InsertDescription")] = bIsWritable;
- m_aCommandAvailability[ C2U(".uno:InsertAxis")] = bIsWritable && m_apModelState->bSupportsAxes;
- m_aCommandAvailability[ C2U(".uno:InsertGrids")] = bIsWritable && m_apModelState->bSupportsAxes;
-// m_aCommandAvailability[ C2U(".uno:InsertStatistics")] = bIsWritable && m_apModelState->bSupportsStatistics;
- m_aCommandAvailability[ C2U(".uno:InsertTrendlines")] = bIsWritable && m_apModelState->bSupportsStatistics;
- m_aCommandAvailability[ C2U(".uno:InsertMeanValues")] = bIsWritable && m_apModelState->bSupportsStatistics;
- m_aCommandAvailability[ C2U(".uno:InsertYErrorbars")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertTitles")] = m_aCommandAvailability[ C2U(".uno:InsertMenuTitles")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertLegend")] = m_aCommandAvailability[ C2U(".uno:InsertMenuLegend")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteLegend")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertRemoveAxes")] = m_aCommandAvailability[ C2U(".uno:InsertMenuAxes")] = bIsWritable && m_apModelState->bSupportsAxes;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuGrids")] = bIsWritable && m_apModelState->bSupportsAxes;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuTrendlines")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuMeanValues")] = bIsWritable && m_apModelState->bSupportsStatistics;
+ m_aCommandAvailability[ C2U(".uno:InsertMenuYErrorBars")] = bIsWritable && m_apModelState->bSupportsStatistics;
m_aCommandAvailability[ C2U(".uno:InsertSymbol")] = bIsWritable && m_apControllerState->bIsTextObject;
// format objects
- m_aCommandAvailability[ C2U(".uno:DiagramObjects")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected;
+ bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected;
+ m_aCommandAvailability[ C2U(".uno:FormatSelection")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatAxis")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatTitle")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataSeries")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataPoint")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataLabels")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatDataLabel")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatYErrorBars;
+ m_aCommandAvailability[ C2U(".uno:FormatMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatMeanValue;
+ m_aCommandAvailability[ C2U(".uno:FormatTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendline;
+ m_aCommandAvailability[ C2U(".uno:FormatTrendlineEquation")] = bFormatObjectAvailable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendlineEquation;
+ m_aCommandAvailability[ C2U(".uno:FormatStockLoss")] = bFormatObjectAvailable;
+ m_aCommandAvailability[ C2U(".uno:FormatStockGain")] = bFormatObjectAvailable;
+
m_aCommandAvailability[ C2U(".uno:DiagramType")] = bIsWritable;
m_aCommandAvailability[ C2U(".uno:Legend")] = bIsWritable && m_apModelState->bHasLegend;
m_aCommandAvailability[ C2U(".uno:DiagramWall")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasWall;
m_aCommandAvailability[ C2U(".uno:DiagramArea")] = bIsWritable;
- m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsDraggableObject;
+ m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsPositionableObject;
// 3d commands
m_aCommandAvailability[ C2U(".uno:View3D")] = bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD;
m_aCommandAvailability[ C2U(".uno:DiagramFloor")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasFloor;
+ //some mor format commands with different ui text
+ m_aCommandAvailability[ C2U(".uno:FormatWall")] = m_aCommandAvailability[ C2U(".uno:DiagramWall")];
+ m_aCommandAvailability[ C2U(".uno:FormatFloor")] = m_aCommandAvailability[ C2U(".uno:DiagramFloor")];
+ m_aCommandAvailability[ C2U(".uno:FormatChartArea")] = m_aCommandAvailability[ C2U(".uno:DiagramArea")];
+ m_aCommandAvailability[ C2U(".uno:FormatLegend")] = m_aCommandAvailability[ C2U(".uno:Legend")];
+
// depending on own data
m_aCommandAvailability[ C2U(".uno:DataRanges")] = bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData);
m_aCommandAvailability[ C2U(".uno:DiagramData")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasOwnData;
@@ -578,14 +637,36 @@ void ControllerCommandDispatch::updateCommandAvailability()
m_aCommandAvailability[ C2U(".uno:Backward")] = ( bShapeContext ? isShapeControllerCommandAvailable( C2U( ".uno:Backward" ) ) :
( bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward ) );
+ m_aCommandAvailability[ C2U(".uno:InsertDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertDataLabel")] = bIsWritable;
m_aCommandAvailability[ C2U(".uno:InsertMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddMeanValue;
m_aCommandAvailability[ C2U(".uno:InsertTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendline;
m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation;
- m_aCommandAvailability[ C2U(".uno:InsertYErrorbar")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars;
-
- m_aCommandAvailability[ C2U(".uno:DeleteTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline;
- m_aCommandAvailability[ C2U(".uno:DeleteMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue;
- m_aCommandAvailability[ C2U(".uno:DeleteYErrorbar")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars;
+ m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquationAndR2")] = m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")];
+ m_aCommandAvailability[ C2U(".uno:InsertR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value;
+ m_aCommandAvailability[ C2U(".uno:DeleteR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value;
+
+ m_aCommandAvailability[ C2U(".uno:InsertYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars;
+
+ m_aCommandAvailability[ C2U(".uno:DeleteDataLabels")] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteDataLabel") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteTrendline") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline;
+ m_aCommandAvailability[ C2U(".uno:DeleteTrendlineEquation") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendlineEquation;
+ m_aCommandAvailability[ C2U(".uno:DeleteMeanValue") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue;
+ m_aCommandAvailability[ C2U(".uno:DeleteYErrorBars") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars;
+
+ m_aCommandAvailability[ C2U(".uno:ResetDataPoint") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:ResetAllDataPoints") ] = bIsWritable;
+
+ m_aCommandAvailability[ C2U(".uno:InsertAxis") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteAxis") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertAxisTitle") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:FormatMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteMajorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:FormatMinorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:InsertMinorGrid") ] = bIsWritable;
+ m_aCommandAvailability[ C2U(".uno:DeleteMinorGrid") ] = bIsWritable;
}
bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand )
@@ -612,11 +693,19 @@ void ControllerCommandDispatch::fireStatusEvent(
const OUString & rURL,
const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
{
+ bool bIsChartSelectorURL = rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:ChartElementSelector") );
+ if( rURL.getLength() == 0 || bIsChartSelectorURL )
+ {
+ uno::Any aArg;
+ aArg <<= m_xController;
+ fireStatusEventForURL( C2U(".uno:ChartElementSelector"), aArg, true, xSingleListener );
+ }
+
if( rURL.getLength() == 0 )
for( ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.begin());
aIt != m_aCommandAvailability.end(); ++aIt )
fireStatusEventForURLImpl( aIt->first, xSingleListener );
- else
+ else if( !bIsChartSelectorURL )
fireStatusEventForURLImpl( rURL, xSingleListener );
// statusbar. Should be handled by base implementation
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
new file mode 100644
index 000000000000..a79a256e3e4f
--- /dev/null
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ElementSelector.cxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "ElementSelector.hxx"
+#include "macros.hxx"
+#include "ObjectNameProvider.hxx"
+#include "ObjectHierarchy.hxx"
+#include "servicenames.hxx"
+#include <chartview/ExplicitValueProvider.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/frame/XControlNotificationListener.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+namespace chart
+{
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ElementSelectorToolbarController" ));
+}
+
+//------------------------------------------------------------------------------
+
+SelectorListBox::SelectorListBox( Window* pParent, WinBits nStyle )
+ : ListBox( pParent, nStyle )
+ , m_bReleaseFocus( true )
+{
+}
+
+SelectorListBox::~SelectorListBox()
+{
+}
+
+void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tCID & rParent, std::vector< ListBoxEntryData >& rEntries
+ , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
+{
+ ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
+ ObjectHierarchy::tChildContainer::const_iterator aIt( aChildren.begin());
+ while( aIt != aChildren.end() )
+ {
+ ::rtl::OUString aCID = *aIt;
+ ListBoxEntryData aEntry;
+ aEntry.CID = aCID;
+ aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc );
+ aEntry.nHierarchyDepth = nHierarchyDepth;
+ rEntries.push_back(aEntry);
+ lcl_addObjectsToList( rHierarchy, aCID, rEntries, nHierarchyDepth+1, xChartDoc );
+ ++aIt;
+ }
+}
+
+void SelectorListBox::SetChartController( const Reference< frame::XController >& xChartController )
+{
+ m_xChartController = xChartController;
+}
+
+void SelectorListBox::UpdateChartElementsListAndSelection()
+{
+ Clear();
+ m_aEntries.clear();
+
+ Reference< frame::XController > xChartController( m_xChartController );
+ if( xChartController.is() )
+ {
+ Reference< view::XSelectionSupplier > xSelectionSupplier( xChartController, uno::UNO_QUERY);
+ rtl::OUString aSelectedCID;
+ if( xSelectionSupplier.is() )
+ xSelectionSupplier->getSelection() >>= aSelectedCID;
+
+ Reference< chart2::XChartDocument > xChartDoc( xChartController->getModel(), uno::UNO_QUERY );
+ ObjectType eType( ObjectIdentifier::getObjectType( aSelectedCID ));
+ bool bAddSelectionToList = false;
+ if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
+ bAddSelectionToList = true;
+
+ Reference< uno::XInterface > xChartView;
+ Reference< lang::XMultiServiceFactory > xFact( xChartController->getModel(), uno::UNO_QUERY );
+ if( xFact.is() )
+ xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
+ ExplicitValueProvider* pExplicitValueProvider = 0;//ExplicitValueProvider::getExplicitValueProvider(xChartView); dies erzeugt alle sichtbaren datenpinkte, das ist zu viel
+ ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
+ lcl_addObjectsToList( aHierarchy, aHierarchy.getRootNodeCID(), m_aEntries, 0, xChartDoc );
+
+ std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() );
+ if( bAddSelectionToList )
+ {
+ rtl::OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
+ for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
+ {
+ if( aIt->CID.match( aSeriesCID ) )
+ {
+ ListBoxEntryData aEntry;
+ aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
+ aEntry.CID = aSelectedCID;
+ ++aIt;
+ if( aIt != m_aEntries.end() )
+ m_aEntries.insert(aIt, aEntry);
+ else
+ m_aEntries.push_back( aEntry );
+ break;
+ }
+ }
+ }
+
+ USHORT nEntryPosToSelect = 0; bool bSelectionFound = false;
+ aIt = m_aEntries.begin();
+ for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN )
+ {
+ InsertEntry( aIt->UIName );
+ if( !bSelectionFound && aSelectedCID.equals( aIt->CID ) )
+ {
+ nEntryPosToSelect = nN;
+ bSelectionFound = true;
+ }
+ }
+
+ if( bSelectionFound )
+ SelectEntryPos(nEntryPosToSelect);
+
+ USHORT nEntryCount = GetEntryCount();
+ if( nEntryCount > 100 )
+ nEntryCount = 100;
+ SetDropDownLineCount( nEntryCount );
+ }
+ SaveValue();//remind current selection pos
+}
+
+void SelectorListBox::ReleaseFocus_Impl()
+{
+ if ( !m_bReleaseFocus )
+ {
+ m_bReleaseFocus = true;
+ return;
+ }
+
+ Reference< frame::XController > xController( m_xChartController );
+ Reference< frame::XFrame > xFrame( xController->getFrame() );
+ if ( xFrame.is() && xFrame->getContainerWindow().is() )
+ xFrame->getContainerWindow()->setFocus();
+}
+
+void SelectorListBox::Select()
+{
+ ListBox::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ USHORT nPos = GetSelectEntryPos();
+ if( nPos < m_aEntries.size() )
+ {
+ rtl::OUString aCID = m_aEntries[nPos].CID;
+ uno::Any aASelection( uno::makeAny(aCID) );
+ Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY );
+ if( xSelectionSupplier.is() )
+ xSelectionSupplier->select(aASelection);
+ }
+ ReleaseFocus_Impl();
+ }
+}
+
+long SelectorListBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ m_bReleaseFocus = false;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SelectEntryPos( GetSavedValue() ); //restore saved selection
+ ReleaseFocus_Impl();
+ break;
+ }
+ }
+ else if ( EVENT_LOSEFOCUS == rNEvt.GetType() )
+ {
+ if ( !HasFocus() )
+ SelectEntryPos( GetSavedValue() );
+ }
+
+ return nHandled ? nHandled : ListBox::Notify( rNEvt );
+}
+
+Reference< ::com::sun::star::accessibility::XAccessible > SelectorListBox::CreateAccessible()
+{
+ UpdateChartElementsListAndSelection();
+ return ListBox::CreateAccessible();
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ElementSelectorToolbarController, lcl_aServiceName );
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > ElementSelectorToolbarController::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices(1);
+ aServices[ 0 ] = C2U( "com.sun.star.frame.ToolbarController" );
+ return aServices;
+}
+// -----------------------------------------------------------------------------
+ElementSelectorToolbarController::ElementSelectorToolbarController( const uno::Reference< uno::XComponentContext > & xContext )
+ : m_xCC( xContext )
+{
+}
+// -----------------------------------------------------------------------------
+ElementSelectorToolbarController::~ElementSelectorToolbarController()
+{
+}
+// -----------------------------------------------------------------------------
+// XInterface
+Any SAL_CALL ElementSelectorToolbarController::queryInterface( const Type& _rType ) throw (RuntimeException)
+{
+ Any aReturn = ToolboxController::queryInterface(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ElementSelectorToolbarController_BASE::queryInterface(_rType);
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::release() throw ()
+{
+ ToolboxController::release();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::initialize( const Sequence< Any >& rArguments ) throw (Exception, RuntimeException)
+{
+ ToolboxController::initialize(rArguments);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException )
+{
+ if( m_apSelectorListBox.get() )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if( rEvent.FeatureURL.Path.equalsAscii( "ChartElementSelector" ) )
+ {
+ Reference< frame::XController > xChartController;
+ rEvent.State >>= xChartController;
+ m_apSelectorListBox->SetChartController( xChartController );
+ m_apSelectorListBox->UpdateChartElementsListAndSelection();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::createItemWindow( const uno::Reference< awt::XWindow >& xParent )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< awt::XWindow > xItemWindow;
+ if( !m_apSelectorListBox.get() )
+ {
+ Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ if( pParent )
+ {
+ m_apSelectorListBox = ::std::auto_ptr< SelectorListBox >( new SelectorListBox( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) );
+ ::Size aLogicalSize( 95, 160 );
+ ::Size aPixelSize = m_apSelectorListBox->LogicToPixel( aLogicalSize, MAP_APPFONT );
+ m_apSelectorListBox->SetSizePixel( aPixelSize );
+ m_apSelectorListBox->SetDropDownLineCount( 5 );
+ }
+ }
+ if( m_apSelectorListBox.get() )
+ xItemWindow = VCLUnoHelper::GetInterface( m_apSelectorListBox.get() );
+ return xItemWindow;
+}
+
+//..........................................................................
+} // chart2
+//..........................................................................
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
new file mode 100644
index 000000000000..3992745c9f02
--- /dev/null
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ElementSelector.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHART_ELEMENTSELECTOR_HXX
+#define _CHART_ELEMENTSELECTOR_HXX
+
+#include "ServiceMacros.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <svtools/toolboxcontroller.hxx>
+
+#include <vcl/lstbox.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+struct ListBoxEntryData
+{
+ rtl::OUString UIName;
+ rtl::OUString CID;
+ sal_Int32 nHierarchyDepth;
+
+ ListBoxEntryData() : nHierarchyDepth(0)
+ {
+ }
+};
+
+class SelectorListBox : public ListBox
+{
+ public:
+ SelectorListBox( Window* pParent, WinBits nStyle );
+ virtual ~SelectorListBox();
+
+ virtual void Select();
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ void ReleaseFocus_Impl();
+
+ void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController );
+ void UpdateChartElementsListAndSelection();
+
+ private:
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XController > m_xChartController;
+
+ ::std::vector< ListBoxEntryData > m_aEntries;
+
+ bool m_bReleaseFocus;
+};
+
+// ------------------------------------------------------------------
+// ------------------------------------------------------------------
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
+
+class ElementSelectorToolbarController : public ::svt::ToolboxController
+ , ElementSelectorToolbarController_BASE
+{
+public:
+ ElementSelectorToolbarController( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~ElementSelectorToolbarController();
+
+ // XServiceInfo
+ APPHELPER_XSERVICEINFO_DECL()
+ APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController)
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ // XToolbarController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //no default constructor
+ ElementSelectorToolbarController(){}
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC;
+ ::std::auto_ptr< SelectorListBox > m_apSelectorListBox;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+#endif
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index c4dac17db9ab..5a35962388bb 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -41,6 +41,8 @@
#include "macros.hxx"
#include "LineProperties.hxx"
#include "ChartTypeHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "LegendHelper.hxx"
#include "chartview/DrawModelWrapper.hxx"
#include <map>
@@ -111,6 +113,18 @@ void lcl_getChildOIDs(
}
}
+void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const Reference< frame::XModel >& xChartModel )
+{
+ Reference< XTitled > xAxisTitled( xAxis, uno::UNO_QUERY );
+ if( xAxisTitled.is())
+ {
+ Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject());
+ if( xAxisTitle.is())
+ rContainer.push_back(
+ ::chart::ObjectIdentifier( ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xChartModel ) ) );
+ }
+}
+
} // anonymous namespace
namespace chart
@@ -125,9 +139,9 @@ public:
explicit ImplObjectHierarchy(
const Reference< XChartDocument >& xChartDocument,
ExplicitValueProvider* pExplicitValueProvider,
- bool bFlattenDiagram );
+ bool bFlattenDiagram, bool bOrderingForElementSelector );
- bool hasChildren( const ObjectHierarchy::tOID& rParent );
+ bool hasChildren( const ObjectHierarchy::tOID& rParent );
ObjectHierarchy::tChildContainer getChildren( const ObjectHierarchy::tOID& rParent );
ObjectHierarchy::tChildContainer getSiblings( const ObjectHierarchy::tOID& rNode );
@@ -135,14 +149,26 @@ public:
private:
void createTree( const Reference< XChartDocument > & xChartDocument );
+ void createAxesTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram );
void createDiagramTree(
ObjectHierarchy::tChildContainer& rContainer,
const Reference< XChartDocument >& xChartDoc,
const Reference< XDiagram >& xDiagram );
void createDataSeriesTree(
- ObjectHierarchy::tChildContainer& rOutDiagramSubContainer,
- const Reference< XCoordinateSystemContainer >& xCooSysCnt );
+ ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
+ const Reference< XDiagram > & xDiagram );
+ void createWallAndFloor(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XDiagram > & xDiagram );
+ void createLegendTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram );
void createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer );
+
ObjectHierarchy::tOID getParentImpl(
const ObjectHierarchy::tOID& rParentOID,
const ObjectHierarchy::tOID& rOID );
@@ -152,14 +178,17 @@ private:
tChildMap m_aChildMap;
ExplicitValueProvider* m_pExplicitValueProvider;
bool m_bFlattenDiagram;
+ bool m_bOrderingForElementSelector;
};
ImplObjectHierarchy::ImplObjectHierarchy(
const Reference< XChartDocument >& xChartDocument,
ExplicitValueProvider* pExplicitValueProvider,
- bool bFlattenDiagram ) :
+ bool bFlattenDiagram,
+ bool bOrderingForElementSelector ) :
m_pExplicitValueProvider( pExplicitValueProvider ),
- m_bFlattenDiagram( bFlattenDiagram )
+ m_bFlattenDiagram( bFlattenDiagram ),
+ m_bOrderingForElementSelector( bOrderingForElementSelector )
{
createTree( xChartDocument );
// don't remember this helper to avoid access after lifetime
@@ -173,10 +202,21 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
//@todo: change ObjectIdentifier to take an XChartDocument rather than XModel
Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY );
+ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) );
+ ObjectHierarchy::tOID aDiaOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xModel ) ) );
ObjectHierarchy::tChildContainer aTopLevelContainer;
// First Level
+ // Chart Area
+ if( m_bOrderingForElementSelector )
+ {
+ aTopLevelContainer.push_back( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
+ aTopLevelContainer.push_back( aDiaOID );
+ createWallAndFloor( aTopLevelContainer, xDiagram );
+ createLegendTree( aTopLevelContainer, xChartDocument, xDiagram );
+ }
+
// Main Title
Reference< XTitled > xDocTitled( xChartDocument, uno::UNO_QUERY );
if( xDocTitled.is())
@@ -187,7 +227,6 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xMainTitle, xModel ) ) );
}
- Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ));
if( xDiagram.is())
{
// Sub Title. Note: This is interpreted of being top level
@@ -200,24 +239,17 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xSubTitle, xModel ) ) );
}
- // Axis Titles. Note: These are interpreted of being top level
- Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ if( !m_bOrderingForElementSelector )
{
- Reference< XTitled > xAxisTitled( aAxes[i], uno::UNO_QUERY );
- if( xAxisTitled.is())
- {
- Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject());
- if( xAxisTitle.is())
- aTopLevelContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xModel ) ) );
- }
+ // Axis Titles. Note: These are interpreted of being top level
+ Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
+ for( sal_Int32 i=0; i<aAxes.getLength(); ++i )
+ lcl_addAxisTitle( aAxes[i], aTopLevelContainer, xModel );
+
+ // Diagram
+ aTopLevelContainer.push_back( aDiaOID );
}
- // Diagram
- ObjectHierarchy::tOID aDiaOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xModel ) ) );
- OSL_ASSERT( aDiaOID.getObjectCID().getLength() );
- aTopLevelContainer.push_back( aDiaOID );
if( m_bFlattenDiagram )
createDiagramTree( aTopLevelContainer, xChartDocument, xDiagram );
else
@@ -228,63 +260,62 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
m_aChildMap[ aDiaOID ] = aSubContainer;
}
- // Legend. Note: This is interpreted of being top level
- Reference< XLegend > xLegend( xDiagram->getLegend());
- if( xLegend.is())
- {
- Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY );
- bool bShow = false;
- if( xLegendProp.is() &&
- (xLegendProp->getPropertyValue( C2U("Show")) >>= bShow) &&
- bShow )
- {
- ObjectHierarchy::tOID aLegendOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, xModel ) ) );
- aTopLevelContainer.push_back( aLegendOID );
-
- // iterate over child shapes of legend and search for matching OIDs
- if( m_pExplicitValueProvider )
- {
- Reference< container::XIndexAccess > xLegendShapeContainer(
- m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ), uno::UNO_QUERY );
- ObjectHierarchy::tChildContainer aLegendEntryOIDs;
- lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
-
- m_aChildMap[ aLegendOID ] = aLegendEntryOIDs;
- }
- }
- }
+ if( !m_bOrderingForElementSelector )
+ createLegendTree( aTopLevelContainer, xChartDocument, xDiagram );
}
// #i12587# support for shapes in chart
- createAdditionalShapesTree( aTopLevelContainer );
+ if ( !m_bOrderingForElementSelector )
+ {
+ createAdditionalShapesTree( aTopLevelContainer );
+ }
// Chart Area
- aTopLevelContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
+ if( !m_bOrderingForElementSelector )
+ aTopLevelContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ) );
if( ! aTopLevelContainer.empty())
m_aChildMap[ ObjectHierarchy::getRootNodeOID() ] = aTopLevelContainer;
}
-void ImplObjectHierarchy::createDiagramTree(
- ObjectHierarchy::tChildContainer& rContainer,
- const Reference< XChartDocument >& xChartDoc,
- const Reference< XDiagram >& xDiagram )
+void ImplObjectHierarchy::createLegendTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
{
- // Data Series
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- createDataSeriesTree( rContainer, xCooSysCnt );
+ if( xDiagram.is() && LegendHelper::hasLegend( xDiagram ) )
+ {
+ ObjectHierarchy::tOID aLegendOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram->getLegend(), Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) ) ) );
+ rContainer.push_back( aLegendOID );
+
+ // iterate over child shapes of legend and search for matching CIDs
+ if( m_pExplicitValueProvider )
+ {
+ Reference< container::XIndexAccess > xLegendShapeContainer(
+ m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ), uno::UNO_QUERY );
+ ObjectHierarchy::tChildContainer aLegendEntryOIDs;
+ lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
+
+ m_aChildMap[ aLegendOID ] = aLegendEntryOIDs;
+ }
+ }
+}
- // Axes
+void ImplObjectHierarchy::createAxesTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
+{
+ Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 );
- bool bIsThreeD = ( nDimensionCount == 3 );
- bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
if( bSupportsAxesGrids )
{
Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) );
- ::std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(),
+ if( !m_bOrderingForElementSelector )
+ ::std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(),
::std::back_inserter( rContainer ),
lcl_ObjectToOID( xChartDoc ));
@@ -298,12 +329,30 @@ void ImplObjectHierarchy::createDiagramTree(
if(!xAxis.is())
continue;
+ sal_Int32 nCooSysIndex = 0;
+ sal_Int32 nDimensionIndex = 0;
+ sal_Int32 nAxisIndex = 0;
+ AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex );
+ if( nAxisIndex>0 && !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, nDimensionIndex ) )
+ continue;
+
+ if( m_bOrderingForElementSelector )
+ {
+ // axis
+ if( AxisHelper::isAxisVisible( xAxis ) )
+ rContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel ) ) );
+
+ // axis title
+ lcl_addAxisTitle( aAxes[nA], rContainer, xChartModel );
+ }
+
Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
if( AxisHelper::isGridVisible( xGridProperties ) )
{
//main grid
rContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel ) ) );
+ ObjectIdentifier( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel ) ) ) );
}
Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );;
@@ -315,36 +364,61 @@ void ImplObjectHierarchy::createDiagramTree(
{
//sub grid
rContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGrid ) ) );
+ ObjectIdentifier( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGrid ) ) ) );
}
}
}
}
+}
- // Wall
- if( bHasWall )
+void ImplObjectHierarchy::createWallAndFloor(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XDiagram > & xDiagram )
+{
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ bool bIsThreeD = ( nDimensionCount == 3 );
+ bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ if( bHasWall && bIsThreeD )
{
rContainer.push_back(
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) ) );
- }
- // Floor
- if( bHasWall && bIsThreeD )
- {
Reference< beans::XPropertySet > xFloor( xDiagram->getFloor());
if( xFloor.is())
rContainer.push_back(
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, rtl::OUString() ) ) );
}
+
+}
+
+void ImplObjectHierarchy::createDiagramTree(
+ ObjectHierarchy::tChildContainer & rContainer,
+ const Reference< XChartDocument > & xChartDoc,
+ const Reference< XDiagram > & xDiagram )
+{
+ if( !m_bOrderingForElementSelector )
+ {
+ createDataSeriesTree( rContainer, xDiagram );
+ createAxesTree( rContainer, xChartDoc, xDiagram );
+ createWallAndFloor( rContainer, xDiagram );
+ }
+ else
+ {
+ createAxesTree( rContainer, xChartDoc, xDiagram );
+ createDataSeriesTree( rContainer, xDiagram );
+ }
}
void ImplObjectHierarchy::createDataSeriesTree(
- ObjectHierarchy::tChildContainer& rOutDiagramSubContainer,
- const Reference< XCoordinateSystemContainer >& xCooSysCnt )
+ ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
+ const Reference< XDiagram > & xDiagram )
{
+ Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+
try
{
sal_Int32 nDiagramIndex = 0;
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
xCooSysCnt->getCoordinateSystems());
for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
@@ -353,10 +427,11 @@ void ImplObjectHierarchy::createDataSeriesTree(
Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypeSeq.getLength(); ++nCTIdx )
{
- Reference< XDataSeriesContainer > xDSCnt( aChartTypeSeq[nCTIdx], uno::UNO_QUERY_THROW );
+ Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] );
+ Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
const sal_Int32 nNumberOfSeries =
- ChartTypeHelper::getNumberOfDisplayedSeries( aChartTypeSeq[nCTIdx], aSeriesSeq.getLength());
+ ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength());
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; ++nSeriesIdx )
{
@@ -369,45 +444,53 @@ void ImplObjectHierarchy::createDataSeriesTree(
ObjectHierarchy::tChildContainer aSeriesSubContainer;
- // Statistics
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
- if( xCurveCnt.is())
+ Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
+
+ // data lablels
+ if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
{
- Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves());
- for( sal_Int32 nCurveIdx=0; nCurveIdx<aCurves.getLength(); ++nCurveIdx )
- {
- bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
- aSeriesSubContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) ) );
- Reference< beans::XPropertySet > xEqProp( aCurves[nCurveIdx]->getEquationProperties());
- bool bShowEq = false;
- bool bShowCoeff = false;
- if( xEqProp.is() &&
- ( (xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq) ||
- (xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff) ) &&
- ( bShowEq || bShowCoeff ) )
- {
- aSeriesSubContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) ) );
- }
- }
- Reference< beans::XPropertySet > xSeriesProp( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
- Reference< beans::XPropertySet > xErrorBarProp;
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp) &&
- xErrorBarProp.is())
- {
- sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
- if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) &&
- ( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ) )
- {
- aSeriesSubContainer.push_back(
- ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_ERRORS, OUString(), aSeriesParticle ) ) );
- }
- }
+ rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) );
+ aChildParticle+=(C2U("="));
+ aSeriesSubContainer.push_back(
+ ObjectIdetnifier( ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle ) ) );
}
+ // Statistics
+ if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) )
+ {
+ Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
+ if( xCurveCnt.is())
+ {
+ Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves());
+ for( sal_Int32 nCurveIdx=0; nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+ {
+ bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) ) );
+ if( RegressionCurveHelper::hasEquation( aCurves[nCurveIdx] ) )
+ {
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) ) );
+ }
+ }
+ Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xErrorBarProp;
+ if( xSeriesProp.is() &&
+ (xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) &&
+ ( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ) )
+ {
+ aSeriesSubContainer.push_back(
+ ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS, OUString(), aSeriesParticle ) ) );
+ }
+ }
+ }
+ }
+
// Data Points
// iterate over child shapes of legend and search for matching CIDs
if( m_pExplicitValueProvider )
@@ -535,8 +618,9 @@ ObjectHierarchy::tOID ImplObjectHierarchy::getParent(
ObjectHierarchy::ObjectHierarchy(
const Reference< XChartDocument > & xChartDocument,
ExplicitValueProvider * pExplicitValueProvider /* = 0 */,
- bool bFlattenDiagram /* = false */ ) :
- m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram ))
+ bool bFlattenDiagram /* = false */,
+ bool bOrderingForElementSelector /* = false */) :
+ m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram, bOrderingForElementSelector ))
{}
ObjectHierarchy::~ObjectHierarchy()
diff --git a/chart2/source/controller/main/_serviceregistration_controller.cxx b/chart2/source/controller/main/_serviceregistration_controller.cxx
index eb8df08a7e13..32e04593106f 100644
--- a/chart2/source/controller/main/_serviceregistration_controller.cxx
+++ b/chart2/source/controller/main/_serviceregistration_controller.cxx
@@ -36,6 +36,7 @@
#include "dlg_ChartType_UNO.hxx"
#include "ChartDocumentWrapper.hxx"
#include "AccessibleChartView.hxx"
+#include "ElementSelector.hxx"
#include "ShapeToolbarController.hxx"
#include <cppuhelper/implementationentry.hxx>
@@ -82,6 +83,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_controller[] =
, 0
}
,{
+ ::chart::ElementSelectorToolbarController::create
+ , ::chart::ElementSelectorToolbarController::getImplementationName_Static
+ , ::chart::ElementSelectorToolbarController::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
::chart::ShapeToolbarController::create
, ::chart::ShapeToolbarController::getImplementationName_Static
, ::chart::ShapeToolbarController::getSupportedServiceNames_Static
diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk
index d1a5b37688d5..a4e0296d519a 100644
--- a/chart2/source/controller/main/makefile.mk
+++ b/chart2/source/controller/main/makefile.mk
@@ -46,6 +46,7 @@ VISIBILITY_HIDDEN=TRUE
#object files to build and link together to lib $(SLB)$/$(TARGET).lib
SLOFILES = \
$(SLO)$/ConfigurationAccess.obj \
+ $(SLO)$/ElementSelector.obj \
$(SLO)$/SelectionHelper.obj \
$(SLO)$/PositionAndSizeHelper.obj \
$(SLO)$/ChartWindow.obj \
diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk
index be9b76033387..1d8d2b992242 100644
--- a/chart2/source/controller/makefile.mk
+++ b/chart2/source/controller/makefile.mk
@@ -90,6 +90,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SALLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(TKLIB) \
$(TOOLSLIB) \
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index d6d7e14bc7d3..15d5e9cb4ae5 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -98,14 +98,14 @@ public:
static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
- SAL_DLLPRIVATE static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
- SAL_DLLPRIVATE static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
- SAL_DLLPRIVATE static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+ static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
- SAL_DLLPRIVATE static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
static ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index df43e24a9482..9c5cdafe49f2 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -83,6 +83,8 @@ public:
static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries );
SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+ static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
+
static sal_Int32 //one of ::com::sun::star::chart2::AxisType
getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
, sal_Int32 nDimensionIndex );
diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx
index 102ffde71918..493c4d2096e2 100644
--- a/chart2/source/inc/CommonConverters.hxx
+++ b/chart2/source/inc/CommonConverters.hxx
@@ -121,6 +121,10 @@ OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly(
, sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 );
//-----------------------------------------------------------------------------
+OOO_DLLPUBLIC_CHARTTOOLS
+void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet
+ , const com::sun::star::drawing::PolyPolygonShape3D& rAdd );
+//-----------------------------------------------------------------------------
/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D
*/
OOO_DLLPUBLIC_CHARTTOOLS
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index ae179e5c5e83..317c92849fb7 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -188,6 +188,27 @@ OOO_DLLPUBLIC_CHARTTOOLS
sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate );
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex );
+
+OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPointPropertySet );
+
+OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xPointPropertySet );
+
} // namespace DataSeriesHelper
} // namespace chart
diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx
index f6c792ab48f1..f88e2cba0aae 100644
--- a/chart2/source/inc/LegendHelper.hxx
+++ b/chart2/source/inc/LegendHelper.hxx
@@ -52,6 +52,16 @@ class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper
public:
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XLegend >
+ showLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+
+ static void hideLegend( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XLegend >
getLegend( const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xModel
, const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx
index 3f18fa6c46c8..7dbc9e33bf3d 100644
--- a/chart2/source/inc/RegressionCurveHelper.hxx
+++ b/chart2/source/inc/RegressionCurveHelper.hxx
@@ -151,6 +151,10 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+ static void removeEquations(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt );
+
/** adds the given regression curve if there was none before. If there are
regression curves, the first one is replaced by the one given by the
type. All remaining curves are remnoved.
@@ -225,6 +229,10 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XRegressionCurve > & xCurve );
+ static bool hasEquation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XRegressionCurve > & xCurve );
+
private:
// not implemented
RegressionCurveHelper();
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 133f5bcc255b..fea8bb867057 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -33,7 +33,7 @@
// this includes no link dependency
#include <svtools/solar.hrc>
-//next free is 285
+//next free is 290
//single free is: 134
//#define RID_APP_START 30000
@@ -100,6 +100,7 @@
#define STR_STACKED (RID_APP_START + 11)
#define STR_PERCENT (RID_APP_START + 12)
#define STR_DEEP (RID_APP_START + 13)
+#define STR_FILLED (RID_APP_START + 285)
#define STR_DONUT (RID_APP_START + 8)
#define STR_TYPE_PIE (RID_APP_START + 187)
@@ -230,8 +231,11 @@
#define STR_OBJECT_DATASERIES (RID_APP_START + 204)
#define STR_OBJECT_DATASERIES_PLURAL (RID_APP_START + 205)
+#define STR_OBJECT_FOR_SERIES (RID_APP_START + 288)
+#define STR_OBJECT_FOR_ALL_SERIES (RID_APP_START + 289)
+
#define STR_OBJECT_AVERAGE_LINE (RID_APP_START + 174)
-#define STR_OBJECT_ERROR_INDICATOR (RID_APP_START + 175)
+#define STR_OBJECT_ERROR_BARS (RID_APP_START + 175)
#define STR_OBJECT_CURVE (RID_APP_START + 176)
#define STR_OBJECT_CURVES (RID_APP_START + 130)
@@ -244,6 +248,9 @@
#define STR_OBJECT_AXIS_Y (RID_APP_START + 212)
#define STR_OBJECT_AXIS_Z (RID_APP_START + 213)
+#define STR_OBJECT_SECONDARY_X_AXIS (RID_APP_START + 286)
+#define STR_OBJECT_SECONDARY_Y_AXIS (RID_APP_START + 287)
+
#define STR_OBJECT_GRID (RID_APP_START + 214)
#define STR_OBJECT_GRIDS (RID_APP_START + 215)
@@ -267,7 +274,7 @@
#define STR_PAGE_BORDER (RID_APP_START + 217)
#define STR_PAGE_AREA (RID_APP_START + 218)
#define STR_PAGE_TRANSPARENCY (RID_APP_START + 219)
-#define STR_PAGE_CHARACTERS (RID_APP_START + 220)
+#define STR_PAGE_FONT (RID_APP_START + 220)
#define STR_PAGE_FONT_EFFECTS (RID_APP_START + 221)
#define STR_PAGE_LAYOUT (RID_APP_START + 222)
#define STR_PAGE_OPTIONS (RID_APP_START + 223)
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 1c2782de3852..1e824798fa66 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -42,6 +42,7 @@ namespace chart
#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")
#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType")
diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/model/inc/DataSeries.hxx
index 387d69d1f9ab..e483cc96e5b5 100644
--- a/chart2/source/model/inc/DataSeries.hxx
+++ b/chart2/source/model/inc/DataSeries.hxx
@@ -111,6 +111,10 @@ protected:
SAL_CALL getDataPointByIndex( sal_Int32 nIndex )
throw (::com::sun::star::lang::IndexOutOfBoundsException,
::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetAllDataPoints()
+ throw (::com::sun::star::uno::RuntimeException);
// ____ XDataSink ____
// ___________________
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 9f331ce2a215..0d76aab40366 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -419,6 +419,31 @@ Reference< beans::XPropertySet >
// \--
}
+void SAL_CALL DataSeries::resetDataPoint( sal_Int32 nIndex )
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex ));
+ if( aIt != m_aAttributedDataPoints.end())
+ {
+ Reference< beans::XPropertySet > xDataPointProp( (*aIt).second );
+ Reference< util::XModifyBroadcaster > xBroadcaster( xDataPointProp, uno::UNO_QUERY );
+ if( xBroadcaster.is() && m_xModifyEventForwarder.is())
+ xBroadcaster->removeModifyListener( m_xModifyEventForwarder );
+ m_aAttributedDataPoints.erase(aIt);
+ fireModifyEvent();
+ }
+}
+
+void SAL_CALL DataSeries::resetAllDataPoints()
+ throw (uno::RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+ ModifyListenerHelper::removeListenerFromAllMapElements( m_aAttributedDataPoints, m_xModifyEventForwarder );
+ m_aAttributedDataPoints.clear();
+ fireModifyEvent();
+}
+
// ____ XDataSink ____
void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData )
throw (uno::RuntimeException)
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index 0e4a3a119a02..bb419a10f1ac 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -128,6 +128,9 @@ enum TemplateId
TEMPLATE_PERCENTSTACKEDNET,
TEMPLATE_PERCENTSTACKEDNETSYMBOL,
TEMPLATE_PERCENTSTACKEDNETLINE,
+ TEMPLATE_FILLEDNET,
+ TEMPLATE_STACKEDFILLEDNET,
+ TEMPLATE_PERCENTSTACKEDFILLEDNET,
TEMPLATE_STOCKLOWHIGHCLOSE,
TEMPLATE_STOCKOPENLOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
@@ -200,6 +203,9 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET )
( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL )
( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE )
+ ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET )
+ ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET )
( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
@@ -503,6 +509,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
StackMode_Y_STACKED_PERCENT, false, true ));
break;
+ case TEMPLATE_FILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_NONE, false, false, true ));
+ break;
+ case TEMPLATE_STACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED, false, false, true ));
+ break;
+ case TEMPLATE_PERCENTSTACKEDFILLEDNET:
+ xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier,
+ StackMode_Y_STACKED_PERCENT, false, false, true ));
+ break;
case TEMPLATE_STOCKLOWHIGHCLOSE:
xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier,
diff --git a/chart2/source/model/template/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx
new file mode 100644
index 000000000000..ce96488270a4
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FilledNetChartType.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "FilledNetChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "PolarCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+
+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 chart
+{
+
+FilledNetChartType::FilledNetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+FilledNetChartType::FilledNetChartType( const FilledNetChartType & rOther ) :
+ NetChartType_Base( rOther )
+{
+}
+
+FilledNetChartType::~FilledNetChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new FilledNetChartType( *this ));
+}
+
+// ____ XChartType ____
+::rtl::OUString SAL_CALL FilledNetChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET;
+}
+
+uno::Sequence< ::rtl::OUString > FilledNetChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_FILLED_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( FilledNetChartType,
+ C2U( "com.sun.star.comp.chart.FilledNetChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx
new file mode 100644
index 000000000000..3e694c12b0dd
--- /dev/null
+++ b/chart2/source/model/template/FilledNetChartType.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FilledNetChartType.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_FILLEDNETCHARTTYPE_HXX
+#define CHART_FILLEDNETCHARTTYPE_HXX
+
+#include "NetChartType.hxx"
+#include "ServiceMacros.hxx"
+
+namespace chart
+{
+
+class FilledNetChartType : public NetChartType_Base
+{
+public:
+ FilledNetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~FilledNetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( FilledNetChartType )
+
+protected:
+ explicit FilledNetChartType( const FilledNetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_FILLEDNETCHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index 9de315679223..757d2dc07122 100644
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -52,76 +52,24 @@ 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(
+NetChartType_Base::NetChartType_Base(
const uno::Reference< uno::XComponentContext > & xContext ) :
ChartType( xContext )
{}
-NetChartType::NetChartType( const NetChartType & rOther ) :
+NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) :
ChartType( rOther )
{
}
-NetChartType::~NetChartType()
+NetChartType_Base::~NetChartType_Base()
{}
-// ____ 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 CHART2_SERVICE_NAME_CHARTTYPE_NET;
-}
-
Reference< XCoordinateSystem > SAL_CALL
- NetChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
@@ -157,42 +105,23 @@ Reference< XCoordinateSystem > SAL_CALL
}
// ____ OPropertySet ____
-uno::Any NetChartType::GetDefaultValue( sal_Int32 nHandle ) const
+uno::Any NetChartType_Base::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;
- // \--
+ return uno::Any();
}
// ____ OPropertySet ____
-::cppu::IPropertyArrayHelper & SAL_CALL NetChartType::getInfoHelper()
+::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
+ uno::Sequence< beans::Property > aProps;
+ static ::cppu::OPropertyArrayHelper aArrayHelper(aProps);
return aArrayHelper;
}
-
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL
- NetChartType::getPropertySetInfo()
+ NetChartType_Base::getPropertySetInfo()
throw (uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo;
@@ -209,6 +138,35 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL
// \--
}
+//-----------------------------------------------------------------------------
+
+NetChartType::NetChartType(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ NetChartType_Base( xContext )
+{}
+
+NetChartType::NetChartType( const NetChartType & rOther ) :
+ NetChartType_Base( 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 CHART2_SERVICE_NAME_CHARTTYPE_NET;
+}
+
uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static()
{
uno::Sequence< ::rtl::OUString > aServices( 3 );
diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx
index f38d110a60ba..97afeeaeea13 100644
--- a/chart2/source/model/template/NetChartType.hxx
+++ b/chart2/source/model/template/NetChartType.hxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: NetChartType.hxx,v $
+ * $RCSfile: NetChartType_Base.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
@@ -36,24 +36,17 @@
namespace chart
{
-class NetChartType : public ChartType
+class NetChartType_Base : public ChartType
{
public:
- NetChartType( ::com::sun::star::uno::Reference<
+ NetChartType_Base( ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > const & xContext );
- virtual ~NetChartType();
-
- APPHELPER_XSERVICEINFO_DECL()
-
- /// establish methods for factory instatiation
- APPHELPER_SERVICE_FACTORY_HELPER( NetChartType )
+ virtual ~NetChartType_Base();
protected:
- explicit NetChartType( const NetChartType & rOther );
+ explicit NetChartType_Base( const NetChartType_Base & rOther );
// ____ XChartType ____
- virtual ::rtl::OUString SAL_CALL getChartType()
- throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL
createCoordinateSystem( ::sal_Int32 DimensionCount )
throw (::com::sun::star::lang::IllegalArgumentException,
@@ -63,13 +56,34 @@ protected:
virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
throw(::com::sun::star::beans::UnknownPropertyException);
- // ____ OPropertySet ____
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
// ____ XPropertySet ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()
throw (::com::sun::star::uno::RuntimeException);
+};
+
+//-------------------------------------------------------------------------------------
+
+class NetChartType : public NetChartType_Base
+{
+public:
+ NetChartType( ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~NetChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( NetChartType )
+
+protected:
+ explicit NetChartType( const NetChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
// ____ XCloneable ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index e348b32b7bc6..9b2c089b7298 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -64,11 +64,13 @@ NetChartTypeTemplate::NetChartTypeTemplate(
const ::rtl::OUString & rServiceName,
StackMode eStackMode,
bool bSymbols,
- bool bHasLines ) :
+ bool bHasLines ,
+ bool bHasFilledArea ) :
ChartTypeTemplate( xContext, rServiceName ),
m_eStackMode( eStackMode ),
m_bHasSymbols( bSymbols ),
- m_bHasLines( bHasLines )
+ m_bHasLines( bHasLines ),
+ m_bHasFilledArea( bHasFilledArea )
{}
NetChartTypeTemplate::~NetChartTypeTemplate()
@@ -110,11 +112,18 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
{
sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
- // check symbol-style
- // for a template with symbols it is ok, if there is at least one series
- // with symbols, otherwise an unknown template is too easy to achieve
+ uno::Reference< beans::XPropertySet > xChartTypeProp(
+ DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW );
+
if( bResult )
{
+ //filled net chart?:
+ if( m_bHasFilledArea )
+ return sal_True;
+
+ // check symbol-style
+ // for a template with symbols it is ok, if there is at least one series
+ // with symbols, otherwise an unknown template is too easy to achieve
bool bSymbolFound = false;
bool bLineFound = false;
@@ -182,8 +191,13 @@ Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_
{
Reference< lang::XMultiServiceFactory > xFact(
GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
+
+ if( m_bHasFilledArea )
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW );
+ else
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx
index 0e963b8d4500..9c17e6639497 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.hxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.hxx
@@ -45,7 +45,8 @@ public:
const ::rtl::OUString & rServiceName,
StackMode eStackMode,
bool bSymbols,
- bool bHasLines = true
+ bool bHasLines = true,
+ bool bHasFilledArea = false
);
virtual ~NetChartTypeTemplate();
@@ -80,6 +81,7 @@ private:
StackMode m_eStackMode;
bool m_bHasSymbols;
bool m_bHasLines;
+ bool m_bHasFilledArea;
};
} // namespace chart
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
index 6e5960410445..7b739ca73830 100644
--- a/chart2/source/model/template/_serviceregistration_charttypes.cxx
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -39,6 +39,7 @@
#include "ColumnChartType.hxx"
#include "LineChartType.hxx"
#include "NetChartType.hxx"
+#include "FilledNetChartType.hxx"
#include "PieChartType.hxx"
#include "ScatterChartType.hxx"
#include "BubbleChartType.hxx"
@@ -96,6 +97,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
, 0
}
,{
+ ::chart::FilledNetChartType::create
+ , ::chart::FilledNetChartType::getImplementationName_Static
+ , ::chart::FilledNetChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{
::chart::PieChartType::create
, ::chart::PieChartType::getImplementationName_Static
, ::chart::PieChartType::getSupportedServiceNames_Static
diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk
index ad8fcd552c8d..63367014ed6b 100644
--- a/chart2/source/model/template/makefile.mk
+++ b/chart2/source/model/template/makefile.mk
@@ -63,6 +63,7 @@ SLOFILES= \
$(SLO)$/ColumnChartType.obj \
$(SLO)$/ColumnLineChartTypeTemplate.obj \
$(SLO)$/DataInterpreter.obj \
+ $(SLO)$/FilledNetChartType.obj \
$(SLO)$/LineChartType.obj \
$(SLO)$/LineChartTypeTemplate.obj \
$(SLO)$/NetChartType.obj \
diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx
index e9893bae0a89..4f558b35df0a 100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -51,9 +51,11 @@
#include <com/sun/star/text/RubyAdjust.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <comphelper/InlineContainer.hxx>
+
// header for struct SvtLinguConfig
#ifndef _SVTOOLS_LINGUCFG_HXX_
#include <svtools/lingucfg.hxx>
@@ -478,16 +480,21 @@ void CharacterProperties::AddDefaultsToMap(
const float fDefaultFontHeight = 13.0;
SvtLinguConfig aLinguConfig;
- lang::Locale aDefaultLocale( C2U( "en" ), C2U( "US" ), OUString() );
+ lang::Locale aDefaultLocale;
aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
lang::Locale aDefaultLocale_CJK;
aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
lang::Locale aDefaultLocale_CTL;
aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
- Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
- Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
- Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
+ using namespace ::com::sun::star::i18n::ScriptType;
+ LanguageType nLang;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aDefaultLocale), LATIN);
+ Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK), ASIAN);
+ Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL), COMPLEX);
+ Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 357cf5c43d92..9e521fa76dae 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -106,6 +106,8 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference<
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines
@@ -197,6 +199,8 @@ sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChar
return sal_False;
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return sal_False;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return sal_False;
}
return sal_True;
}
@@ -335,14 +339,21 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
{
- aRet.realloc(5);
+ aRet.realloc(6);
sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT;
*pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER;
}
+ else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ {
+ aRet.realloc(1);
+ sal_Int32* pSeq = aRet.getArray();
+ *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ }
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
{
aRet.realloc( 1 );
@@ -399,6 +410,8 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2:
rtl::OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return false;
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
}
if( nDimensionCount==3 )
return nDimensionIndex<2;
@@ -579,7 +592,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
*pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE;
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) ||
- aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET))
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
{
aRet.realloc( bStacked ? 2 : 3 );
sal_Int32* pSeq = aRet.getArray();
@@ -609,6 +623,17 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
return aRet;
}
+bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType )
+{
+ if( xChartType.is() )
+ {
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) )
+ return false;
+ }
+ return true;
+}
+
rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
{
rtl::OUString aRet( C2U( "values-y" ) );
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
index 692f6ee54a1b..9452763153a5 100644
--- a/chart2/source/tools/CommonConverters.cxx
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -223,6 +223,29 @@ drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygo
return aRet;
}
+void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+{
+ sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength();
+ sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount;
+ rRet.SequenceX.realloc( nOuterCount );
+ rRet.SequenceY.realloc( nOuterCount );
+ rRet.SequenceZ.realloc( nOuterCount );
+
+ sal_Int32 nIndex = 0;
+ sal_Int32 nOuter = nOuterCount - nAddOuterCount;
+ for( ; nOuter < nOuterCount; nOuter++ )
+ {
+ if( nIndex >= nAddOuterCount )
+ break;
+
+ rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex];
+ rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex];
+ rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex];
+
+ nIndex++;
+ }
+}
+
void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
{
sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 61fecf18b5e7..7203f9ad6e63 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -36,6 +36,7 @@
#include "macros.hxx"
#include "ContainerHelper.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
#include <com/sun/star/chart2/StackingDirection.hpp>
#include <com/sun/star/chart2/data/LabelOrigin.hpp>
@@ -57,6 +58,7 @@
#include <set>
using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
@@ -155,6 +157,50 @@ void lcl_getCooSysAndChartTypeOfSeries(
}
}
+void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries, bool bInsert )
+{
+ try
+ {
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ DataPointLabel aLabelAtSeries;
+ xSeriesProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabelAtSeries;
+ aLabelAtSeries.ShowNumber = bInsert;
+ if( !bInsert )
+ {
+ aLabelAtSeries.ShowNumberInPercent = false;
+ aLabelAtSeries.ShowCategoryName = false;
+ }
+ xSeriesProperties->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabelAtSeries ) );
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = bInsert;
+ if( !bInsert )
+ {
+ aLabel.ShowNumberInPercent = false;
+ aLabel.ShowCategoryName = false;
+ }
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
} // anonymous namespace
// ----------------------------------------
@@ -735,5 +781,141 @@ sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Refere
return nIndex;
}
+bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
+ {
+ Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) );
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ if( bRet )
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex )
+{
+ bool bRet = false;
+ try
+ {
+ Reference< beans::XPropertySet > xProp;
+ Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY );
+ if( xSeriesProperties.is() )
+ {
+ uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
+ if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList )
+ {
+ ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) );
+ ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex );
+ if( aIt != aIndices.end())
+ xProp = xSeries->getDataPointByIndex(nPointIndex);
+ else
+ xProp = xSeriesProperties;
+ }
+ if( xProp.is() )
+ {
+ DataPointLabel aLabel;
+ if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) )
+ bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName;
+ }
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ return bRet;
+}
+
+void insertDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, true /*bInsert*/ );
+}
+
+void deleteDataLabelsFromSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries )
+{
+ lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, false /*bInsert*/ );
+}
+
+
+void insertDataLabelToPoint( const Reference< beans::XPropertySet >& xPointProp )
+{
+ try
+ {
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = true;
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointProp )
+{
+ try
+ {
+ if( xPointProp.is() )
+ {
+ DataPointLabel aLabel;
+ xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel;
+ aLabel.ShowNumber = false;
+ aLabel.ShowNumberInPercent = false;
+ aLabel.ShowCategoryName = false;
+ xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) );
+ }
+ }
+ catch( uno::Exception &e)
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
} // namespace DataSeriesHelper
} // namespace chart
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index ac2a32f93298..fbc8042af27b 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1320,6 +1320,8 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference<
return false;
if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
return false;
+ if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ return false;
}
return true;
}
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 880cd5c72984..4d8f7be112ff 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -393,8 +393,8 @@ void InternalData::swapAllDataAtIndexWithNext( sal_Int32 nAtIndex, bool bDataInC
bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
{
- sal_Int32 nNewColumnCount( ::std::max<sal_Int32>(1, ::std::max<sal_Int32>( m_nColumnCount, nColumnCount )));
- sal_Int32 nNewRowCount( ::std::max<sal_Int32>(1, ::std::max<sal_Int32>( m_nRowCount, nRowCount )));
+ sal_Int32 nNewColumnCount( ::std::max<sal_Int32>( m_nColumnCount, nColumnCount ) );
+ sal_Int32 nNewRowCount( ::std::max<sal_Int32>( m_nRowCount, nRowCount ) );
sal_Int32 nNewSize( nNewColumnCount*nNewRowCount );
bool bGrow = (nNewSize > m_nColumnCount*m_nRowCount);
@@ -412,9 +412,9 @@ bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount )
m_aData.resize( nNewSize );
m_aData = aNewData;
- m_nColumnCount = nNewColumnCount;
- m_nRowCount = nNewRowCount;
}
+ m_nColumnCount = nNewColumnCount;
+ m_nRowCount = nNewRowCount;
return bGrow;
}
@@ -739,6 +739,8 @@ Sequence< Reference< chart2::data::XLabeledDataSequence > >
{
::std::vector< OUString > aLabels( rInternalData.getColumnLabels());
OSL_ASSERT( static_cast< size_t >( nNewIndex ) < aLabels.size());
+ if( aLabels.size() <= static_cast< size_t >( nNewIndex ) )
+ aLabels.resize( nNewIndex+1 );
aLabels[nNewIndex] = impl::FlattenStringSequence( xLabel->getTextualData());
rInternalData.setColumnLabels( aLabels );
Reference< chart2::data::XDataSequence > xNewLabel(
diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx
index 6d21d13f0dc7..60da06f2b638 100644
--- a/chart2/source/tools/LegendHelper.cxx
+++ b/chart2/source/tools/LegendHelper.cxx
@@ -32,18 +32,66 @@
#include "precompiled_chart2.hxx"
#include "LegendHelper.hxx"
#include "macros.hxx"
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XLegend.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <tools/debug.hxx>
using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
//.............................................................................
namespace chart
{
//.............................................................................
+
+//static
+Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::XModel >& xModel
+ , const uno::Reference< uno::XComponentContext >& xContext )
+{
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, xContext, true );
+ uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_True) );
+
+ chart2::RelativePosition aRelativePosition;
+ if( !(xProp->getPropertyValue( C2U( "RelativePosition" )) >>= aRelativePosition) )
+ {
+ chart2::LegendPosition ePos = chart2::LegendPosition_LINE_END;
+ if( !(xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos ) )
+ xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( ePos ));
+
+ chart2::LegendExpansion eExpansion =
+ ( ePos == chart2::LegendPosition_LINE_END ||
+ ePos == chart2::LegendPosition_LINE_START )
+ ? chart2::LegendExpansion_HIGH
+ : chart2::LegendExpansion_WIDE;
+ if( !(xProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion ) )
+ xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExpansion ));
+
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::Any());
+ }
+
+ }
+ return xLegend;
+}
+
+//static
+void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel )
+{
+ uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, 0, false );
+ uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_False) );
+ }
+}
+
// static
uno::Reference< chart2::XLegend > LegendHelper::getLegend(
const uno::Reference< frame::XModel >& xModel
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
index 7686b2c7009d..8a4fd8ce4f7e 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -457,6 +457,39 @@ bool RegressionCurveHelper::removeAllExceptMeanValueLine(
return bRemovedSomething;
}
+void RegressionCurveHelper::removeEquations(
+ uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt )
+{
+ if( xRegCnt.is())
+ {
+ try
+ {
+ uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(
+ xRegCnt->getRegressionCurves());
+ for( sal_Int32 i = 0; i < aCurves.getLength(); ++i )
+ {
+ if( !isMeanValueLine( aCurves[i] ) )
+ {
+ uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] );
+ if( xRegCurve.is() )
+ {
+ uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ;
+ if( xEqProp.is())
+ {
+ xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false ));
+ xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false ));
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
// static
void RegressionCurveHelper::replaceOrAddCurveAndReduceToOne(
tRegressionType eType,
@@ -683,6 +716,24 @@ sal_Int32 RegressionCurveHelper::getRegressionCurveIndex(
return -1;
}
+bool RegressionCurveHelper::hasEquation( const Reference< chart2::XRegressionCurve > & xCurve )
+{
+ bool bHasEquation = false;
+ if( xCurve.is())
+ {
+ uno::Reference< beans::XPropertySet > xEquationProp( xCurve->getEquationProperties());
+ if( xEquationProp.is())
+ {
+ bool bShowEquation = false;
+ bool bShowCoefficient = false;
+ xEquationProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEquation;
+ xEquationProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoefficient;
+ bHasEquation = bShowEquation || bShowCoefficient;
+ }
+ }
+ return bHasEquation;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 6e43ebc75b67..47cc6de405f7 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -112,7 +112,8 @@ VCoordinateSystem::~VCoordinateSystem()
void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget
, const Reference< drawing::XShapes >& xFinalTarget
- , const Reference< lang::XMultiServiceFactory >& xShapeFactory )
+ , const Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
throw (uno::RuntimeException)
{
DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
@@ -125,12 +126,14 @@ void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing:
{
//create and add to target
m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget );
m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget );
}
else
{
//create and added to target
m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget );
+ xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget );
m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget );
}
m_xFinalTarget = xFinalTarget;
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 0b1a17ca7701..406e5d119cd6 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -45,6 +45,7 @@
#include "LabelPositionHelper.hxx"
#include "Clipping.hxx"
#include "Stripe.hxx"
+#include "PolarLabelPositionHelper.hxx"
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -84,6 +85,7 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
+ , m_bIsPolarCooSys( bConnectLastToFirstPoint )
, m_bConnectLastToFirstPoint( bConnectLastToFirstPoint )
, m_bAddOneToXMax(bAddOneToXMax)
, m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
@@ -230,7 +232,7 @@ bool AreaChart::keepAspectRatio() const
void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
{
- if( m_bArea && pSeries )
+ if( m_bArea && !m_bIsPolarCooSys && pSeries )
{
sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
@@ -432,7 +434,12 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
//add second part to the polygon (grounding points or previous series points)
- if(!pPreviousSeriesPoly)
+ if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
+ {
+ if( pPreviousSeriesPoly )
+ addPolygon( aPoly, *pPreviousSeriesPoly );
+ }
+ else if(!pPreviousSeriesPoly)
{
double fMinX = pSeries->m_fLogicMinX;
double fMaxX = pSeries->m_fLogicMaxX;
@@ -726,6 +733,22 @@ void AreaChart::createShapes()
double fLogicX = (*aSeriesIter)->getXValue(nIndex);
double fLogicY = (*aSeriesIter)->getYValue(nIndex);
+ if( m_bIsPolarCooSys && m_bArea &&
+ ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) )
+ {
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ {
+ if( pSeriesList->size() == 1 || nSeriesIndex == 0 )
+ {
+ fLogicY = pPosHelper->getLogicMinY();
+ if( !pPosHelper->isMathematicalOrientationY() )
+ fLogicY = pPosHelper->getLogicMaxY();
+ }
+ else
+ fLogicY = 0.0;
+ }
+ }
+
if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
fLogicY = fabs( fLogicY );
@@ -797,8 +820,22 @@ void AreaChart::createShapes()
//store point information for series polygon
//for area and/or line (symbols only do not need this)
if( isValidPosition(aScaledLogicPosition) )
+ {
AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+ //prepare clipping for filled net charts
+ if( !bIsVisible && m_bIsPolarCooSys && m_bArea )
+ {
+ drawing::Position3D aClippedPos(aScaledLogicPosition);
+ pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 );
+ if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) )
+ {
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex );
+ AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
+ }
+ }
+ }
+
//create a single datapoint if point is visible
//apply clipping:
if( !bIsVisible )
@@ -909,12 +946,29 @@ void AreaChart::createShapes()
break;
}
+ awt::Point aScreenPosition2D;//get the screen position for the labels
+ sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
+ if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE )
+ {
+ PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper);
+ if( pPolarPosHelper )
+ {
+ PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
+ aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
+ eAlignment, fLogicX, fLogicY, fLogicZ, nOffset ));
+ }
+ }
+ else
+ {
+ if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
+ nOffset = 0;
+ aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ }
- awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
- .transformSceneToScreenPosition( aScenePosition3D ) );
this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
, fLogicValueForLabeDisplay
- , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment );
+ , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
}
}
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index ec56d9e2390b..ec90e92ba1a4 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -110,9 +110,11 @@ private: //member
bool m_bArea;//false -> line or symbol only
bool m_bLine;
bool m_bSymbol;
+ bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different)
bool m_bConnectLastToFirstPoint;//used e.g. for net chart
bool m_bAddOneToXMax;//used e.g. for net chart (the angle axis needs a different autoscaling)
bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts
+
sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic
::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index b63603ef403a..6069189ff0ac 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -111,7 +111,7 @@ void BubbleChart::calculateMaximumLogicBubbleSize()
double fSize = pSeries->getBubble_Size( nIndex );
if( m_bShowNegativeValues )
- fSize = abs(fSize);
+ fSize = fabs(fSize);
if( fSize > fMaxSize )
fMaxSize = fSize;
}
@@ -146,7 +146,7 @@ drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize
return aRet;
if( m_bShowNegativeValues )
- fLogicSize = abs(fLogicSize);
+ fLogicSize = fabs(fLogicSize);
double fMaxSize = m_fMaxLogicBubbleSize;
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 73fa9039bf44..c8f473d226d0 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1726,6 +1726,11 @@ bool VSeriesPlotter::PointsWereSkipped() const
return m_bPointsWereSkipped;
}
+bool VSeriesPlotter::WantToPlotInFrontOfAxisLine()
+{
+ return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel );
+}
+
Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries(
LegendExpansion eLegendExpansion
, const Reference< beans::XPropertySet >& xTextProperties
@@ -2070,6 +2075,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
pRet = new PieChart(xChartTypeModel,nDimensionCount);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) );
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) )
+ pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) );
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
pRet = new CandleStickChart(xChartTypeModel,nDimensionCount);
else
diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx
index f9a575be0123..111b1cb02f99 100644
--- a/chart2/source/view/inc/VCoordinateSystem.hxx
+++ b/chart2/source/view/inc/VCoordinateSystem.hxx
@@ -74,7 +74,9 @@ public:
, const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xFinalTarget
, const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ ::com::sun::star::lang::XMultiServiceFactory >& xFactory
+ , ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
throw (::com::sun::star::uno::RuntimeException);
void setParticle( const rtl::OUString& rCooSysParticle );
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index eeb561b13f02..e94ef6c68687 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -296,6 +296,8 @@ public:
virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
+ bool WantToPlotInFrontOfAxisLine();
+
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 31e44dbc245b..eaffe6ea3221 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1378,12 +1378,13 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
drawing::Direction3D aPreferredAspectRatio(
rSeriesPlotterContainer.getPreferredAspectRatio() );
- uno::Reference< drawing::XShapes > xCoordinateRegionTarget(0);
+ uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(0);
+ uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(0);
VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
{//create diagram
aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory);
aVDiagram.createShapes(rAvailablePos,rAvailableSize);
- xCoordinateRegionTarget = aVDiagram.getCoordinateRegion();
+ xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
aVDiagram.reduceToMimimumSize();
}
@@ -1395,7 +1396,7 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
for( nC=0; nC < rVCooSysList.size(); nC++)
{
VCoordinateSystem* pVCooSys = rVCooSysList[nC];
- pVCooSys->initPlottingTargets(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory);
+ pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis);
pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) ));
@@ -1470,7 +1471,15 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
//------------ set transformation to plotter / create series
VSeriesPlotter* pSeriesPlotter = *aPlotterIter;
rtl::OUString aCID; //III
- pSeriesPlotter->initPlotter(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory,aCID);
+ uno::Reference< drawing::XShapes > xSeriesTarget(0);
+ if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() )
+ xSeriesTarget = xSeriesTargetInFrontOfAxis;
+ else
+ {
+ xSeriesTarget = xSeriesTargetBehindAxis;
+ DBG_ASSERT( !lcl_resizeAfterCompleteCreation(xDiagram), "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" );
+ }
+ pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,aCID );
pSeriesPlotter->setPageReferenceSize( rPageSize );
VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter );
if(2==nDimensionCount)
@@ -1504,7 +1513,8 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo
}
//clear and recreate
- ShapeFactory::removeSubShapes( xCoordinateRegionTarget );
+ ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here
+ xSeriesTargetBehindAxis.clear();
ShapeFactory::removeSubShapes( xTextTargetShapes );
//set new transformation
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index d2456110b79b..f537612efd8b 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -151,7 +151,7 @@ void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Ref
void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment )
{
if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO
- && ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) )
+ && (::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue)) )
rfValue = 0.0;
}
@@ -620,24 +620,33 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe
double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getYValue( index );
- double fY_Min = getY_Min( index );
- double fY_Max = getY_Max( index );
- double fY_First = getY_First( index );
- double fY_Last = getY_Last( index );
-
double fMin=0.0;
::rtl::math::setInf(&fMin, false);
- if(fMin>fY)
- fMin=fY;
- if(fMin>fY_First)
- fMin=fY_First;
- if(fMin>fY_Last)
- fMin=fY_Last;
- if(fMin>fY_Min)
- fMin=fY_Min;
- if(fMin>fY_Max)
- fMin=fY_Max;
+
+ if( !m_aValues_Y.is() &&
+ (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
+ || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
+ {
+ double fY_Min = getY_Min( index );
+ double fY_Max = getY_Max( index );
+ double fY_First = getY_First( index );
+ double fY_Last = getY_Last( index );
+
+ if(fMin>fY_First)
+ fMin=fY_First;
+ if(fMin>fY_Last)
+ fMin=fY_Last;
+ if(fMin>fY_Min)
+ fMin=fY_Min;
+ if(fMin>fY_Max)
+ fMin=fY_Max;
+ }
+ else
+ {
+ double fY = getYValue( index );
+ if(fMin>fY)
+ fMin=fY;
+ }
if( ::rtl::math::isInf(fMin) )
::rtl::math::setNan(&fMin);
@@ -647,24 +656,33 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getYValue( index );
- double fY_Min = getY_Min( index );
- double fY_Max = getY_Max( index );
- double fY_First = getY_First( index );
- double fY_Last = getY_Last( index );
-
double fMax=0.0;
::rtl::math::setInf(&fMax, true);
- if(fMax<fY)
- fMax=fY;
- if(fMax<fY_First)
- fMax=fY_First;
- if(fMax<fY_Last)
- fMax=fY_Last;
- if(fMax<fY_Min)
- fMax=fY_Min;
- if(fMax<fY_Max)
- fMax=fY_Max;
+
+ if( !m_aValues_Y.is() &&
+ (m_aValues_Y_Min.is() || m_aValues_Y_Max.is()
+ || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) )
+ {
+ double fY_Min = getY_Min( index );
+ double fY_Max = getY_Max( index );
+ double fY_First = getY_First( index );
+ double fY_Last = getY_Last( index );
+
+ if(fMax<fY_First)
+ fMax=fY_First;
+ if(fMax<fY_Last)
+ fMax=fY_Last;
+ if(fMax<fY_Min)
+ fMax=fY_Min;
+ if(fMax<fY_Max)
+ fMax=fY_Max;
+ }
+ else
+ {
+ double fY = getYValue( index );
+ if(fMax<fY)
+ fMax=fY;
+ }
if( ::rtl::math::isInf(fMax) )
::rtl::math::setNan(&fMax);
diff --git a/chart2/source/view/makefile.mk b/chart2/source/view/makefile.mk
index 58229edf1217..8ab947b9cedc 100644
--- a/chart2/source/view/makefile.mk
+++ b/chart2/source/view/makefile.mk
@@ -82,7 +82,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \
$(SALLIB) \
$(SVLLIB) \
$(SVTOOLLIB) \
- $(SVXLIB) \
+ $(SVXCORELIB) \
$(TOOLSLIB) \
$(UNOTOOLSLIB) \
$(BASEGFXLIB) \
diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml
index 63f72f67d592..788dac2fc90b 100644
--- a/chart2/uiconfig/menubar/menubar.xml
+++ b/chart2/uiconfig/menubar/menubar.xml
@@ -43,22 +43,22 @@
</menu:menu>
<menu:menu menu:id=".uno:InsertMenu" menu:label="" >
<menu:menupopup>
- <menu:menuitem menu:id=".uno:InsertTitle" menu:helpid="30515" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertAxis" menu:helpid="30518" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertGrids" menu:helpid="30540" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertLegend" menu:helpid="30516" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuTitles" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuLegend" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuAxes" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuGrids" menu:label="" />
<menu:menuseparator/>
- <menu:menuitem menu:id=".uno:InsertDescription" menu:helpid="30517" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertTrendlines" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertMeanValues" menu:label="" />
- <menu:menuitem menu:id=".uno:InsertYErrorbars" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuDataLabels" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuTrendlines" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuMeanValues" menu:label="" />
+ <menu:menuitem menu:id=".uno:InsertMenuYErrorBars" menu:label="" />
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:InsertSymbol" menu:helpid="10503" menu:label="" />
</menu:menupopup>
</menu:menu>
<menu:menu menu:id=".uno:FormatMenu" menu:label="" >
<menu:menupopup>
- <menu:menuitem menu:id=".uno:DiagramObjects" menu:helpid="30572" menu:label="" />
+ <menu:menuitem menu:id=".uno:FormatSelection" menu:label="" />
<menu:menuitem menu:id=".uno:TransformDialog" menu:helpid="10087" menu:label="" />
<menu:menu menu:id=".uno:ArrangeRow" menu:label="" >
<menu:menupopup>
@@ -82,6 +82,7 @@
<menu:menuitem menu:id=".uno:AllTitles" menu:helpid="30562" menu:label="" />
</menu:menupopup>
</menu:menu>
+ <menu:menuitem menu:id=".uno:Legend" menu:helpid="30521" menu:label="" />
<menu:menu menu:id=".uno:DiagramAxisMenu" menu:label="" >
<menu:menupopup>
<menu:menuitem menu:id=".uno:DiagramAxisX" menu:helpid="30552" menu:label="" />
@@ -107,7 +108,6 @@
<menu:menuitem menu:id=".uno:DiagramGridAll" menu:helpid="30566" menu:label="" />
</menu:menupopup>
</menu:menu>
- <menu:menuitem menu:id=".uno:Legend" menu:helpid="30521" menu:label="" />
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:DiagramWall" menu:helpid="30524" menu:label="" />
<menu:menuitem menu:id=".uno:DiagramFloor" menu:helpid="30525" menu:label="" />
diff --git a/chart2/uiconfig/toolbar/toolbar.xml b/chart2/uiconfig/toolbar/toolbar.xml
index 042dc7fbe973..41d5bd41ab63 100644
--- a/chart2/uiconfig/toolbar/toolbar.xml
+++ b/chart2/uiconfig/toolbar/toolbar.xml
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:ChartElementSelector" />
+ <toolbar:toolbaritem xlink:href=".uno:FormatSelection" />
+ <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:DiagramType" toolbar:helpid="helpid:30528" toolbar:text="" />
<toolbar:toolbaritem xlink:href=".uno:DiagramData" toolbar:helpid="helpid:30514" toolbar:text="" />
<toolbar:toolbarseparator/>