summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-07-02 19:17:43 +0000
committerRelease Engineers <releng@openoffice.org>2009-07-02 19:17:43 +0000
commit44569a657c4282757443ae06efc6441e571a0409 (patch)
treebf446449db3c764a11e9a327f03f9468fc31e9f5
parentbe14833d0fe6be523299e09a72ae61d93a04bc04 (diff)
CWS-TOOLING: integrate CWS bubblechart
2009-06-17 08:41:14 +0200 hde r273051 : i101635: added new charttype bubble 2009-06-17 08:39:37 +0200 hde r273050 : i101635: created new testcase tCreateNewBubbleChart 2009-06-17 08:38:07 +0200 hde r273049 : i101635: created new testcase tCreateNewBubbleChart 2009-06-15 15:22:32 +0200 hde r272991 : 101635 2009-06-11 12:44:01 +0200 iha r272864 : rebase to dev300m50 2009-06-10 23:27:54 +0200 iha r272841 : CWS-TOOLING: rebase CWS bubblechart to trunk@272827 (milestone: DEV300:m50) 2009-06-04 18:07:35 +0200 iha r272649 : #i64689# Bubble Chart 2009-06-04 17:26:44 +0200 iha r272647 : #i64689# Bubble Chart 2009-06-04 11:24:25 +0200 iha r272618 : #i64689# add more spacing between bubbles and data labels 2009-05-26 18:05:23 +0200 ufi r272314 : i101637 2009-04-22 14:37:50 +0200 iha r271115 : #i64689# bubble chart 2009-04-21 17:52:23 +0200 iha r271052 : #i64689# bubble chart 2009-04-21 17:50:48 +0200 iha r271051 : #i76728# type icon for xy chart 2009-04-21 17:25:52 +0200 iha r271049 : #i76728# type icon for xy chart 2009-04-09 11:18:09 +0200 iha r270685 : #i100977# autoscaling works not correct if missing values should be treated as zero 2009-04-08 16:39:43 +0200 iha r270656 : #i64689# bubble chart - missing value treatment 2009-04-08 15:13:25 +0200 iha r270655 : #i64689# bubble chart - remove unused code 2009-04-08 15:12:19 +0200 iha r270653 : #i64689# bubble chart - determine sereis length correctly on export 2009-04-08 14:22:43 +0200 iha r270650 : #i64689# bubble chart - remove unused code 2009-04-08 14:12:09 +0200 iha r270646 : #i64689# bubble chart - export domains even if no main sequence was found 2009-04-08 14:11:07 +0200 iha r270645 : #i64689# bubble chart - don't replace missing size values with 1.0 2009-04-07 16:20:22 +0200 iha r270602 : #i64689# bubble chart - do not offer percent values for data label display for xy and bubble chart 2009-04-07 16:17:42 +0200 iha r270601 : remove superfluous code 2009-04-06 16:39:32 +0200 iha r270569 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-02 17:33:33 +0200 iha r270427 : use input string for formatting in data table during edit 2009-04-02 16:00:29 +0200 iha r270413 : #i64689# bubble chart - when creating a new series within the data table give it the same number format as the former series, thus the new bubble size values can be edited with the same format immidiately 2009-04-02 11:25:33 +0200 iha r270385 : #i64689# bubble chart -correct automatic numberformat detection for axis, data table and data label + transport data label numberformat during copy paste in addition to axis numberformat 2009-04-01 11:32:03 +0200 iha r270312 : #i64689# bubble chart - add further parameter for view creation 2009-03-31 17:52:08 +0200 iha r270291 : #i64689# bubble chart - scale bubble size with diagram size 2009-03-31 13:38:13 +0200 iha r270278 : #i64689# bubble chart - wrong size for small values < 1 2009-03-27 19:11:07 +0100 iha r270169 : #i64689# bubble chart 2009-03-27 19:07:11 +0100 iha r270168 : #i64689# bubble chart - remove unused code 2009-03-27 18:33:57 +0100 iha r270167 : #i64689# bubble chart - create no shape for invalid sizes 2009-03-27 15:18:21 +0100 iha r270157 : #i76728# type icon for xy chart 2009-03-27 14:34:38 +0100 iha r270156 : #i64689# bubble chart - correct scaling 2009-03-27 14:27:27 +0100 iha r270155 : #i64689# bubble chart - images 2009-03-27 14:25:45 +0100 iha r270154 : #i64689# bubble chart - images 2009-03-27 11:38:57 +0100 iha r270142 : #i64689# bubble chart - values-size is the main series 2009-03-27 11:30:20 +0100 iha r270140 : #i64689# correct order of sequences after load thus switching charttypes afterwards produces expected results now 2009-03-26 10:22:55 +0100 iha r270056 : #i64689# bubble chart 2009-03-24 17:45:15 +0100 iha r269984 : #i64689# bubble chart - user properties from points (not only from the series) 2009-03-24 15:10:57 +0100 dr r269954 : #i64989# export bubble charts to xls 2009-03-24 14:55:29 +0100 dr r269952 : #i64989# import bubble charts from xls 2009-03-24 14:54:46 +0100 dr r269950 : #i64989# import bubble charts from ooxml 2009-03-23 18:59:08 +0100 iha r269895 : further cleanups possible with new member m_aGlobalSeriesImportInfo 2009-03-23 16:54:04 +0100 iha r269886 : #i64689# bubble chart - a single sequence must be interpreted as sizes because of ODF specification 2009-03-23 16:50:43 +0100 iha r269885 : #i64689# save&load bubble chart 2009-03-20 19:30:29 +0100 iha r269826 : CWS-TOOLING: rebase CWS bubblechart to trunk@269781 (milestone: DEV300:m44) 2009-03-19 11:30:33 +0100 iha r269732 : #i64689# rename SchXMLCategoriesDomainContext to SchXMLCategoriesContext avoid confusion with domains 2009-03-18 17:11:13 +0100 iha r269693 : #i64689# add charttype bubble 2009-03-18 17:09:22 +0100 iha r269692 : #i64689# remove unused code 2009-03-13 12:18:26 +0100 iha r269467 : #i64689# corrected lineends 2009-03-12 11:25:14 +0100 iha r269376 : #i64689# bubble chart (part 1)
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx4
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx12
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx13
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx6
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx11
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.hrc28
-rw-r--r--chart2/source/controller/dialogs/Bitmaps.src14
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.hrc26
-rw-r--r--chart2/source/controller/dialogs/Bitmaps_HC.src14
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx36
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx13
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx8
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx38
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx2
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx9
-rw-r--r--chart2/source/controller/dialogs/Strings.src5
-rw-r--r--chart2/source/controller/dialogs/Strings_ChartTypes.src9
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx13
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx1
-rw-r--r--chart2/source/controller/inc/DataPointItemConverter.hxx1
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx11
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx5
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx4
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx5
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx9
-rw-r--r--chart2/source/inc/Strings.hrc6
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx3
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx7
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx1
-rw-r--r--chart2/source/model/template/BubbleChartType.cxx245
-rw-r--r--chart2/source/model/template/BubbleChartType.hxx89
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx322
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx106
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx317
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.hxx64
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx8
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx24
-rw-r--r--chart2/source/model/template/_serviceregistration_charttypes.cxx9
-rw-r--r--chart2/source/model/template/makefile.mk3
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx41
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx52
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx10
-rw-r--r--chart2/source/view/charttypes/BarChart.cxx12
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx420
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx97
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx2
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx4
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx11
-rw-r--r--chart2/source/view/charttypes/makefile.mk3
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx5
-rw-r--r--chart2/source/view/inc/VDataSeries.hxx16
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx1
-rw-r--r--chart2/source/view/main/ChartView.cxx28
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx47
-rw-r--r--chart2/source/view/main/VDataSeries.cxx110
-rw-r--r--sc/source/filter/excel/xechart.cxx14
-rw-r--r--sc/source/filter/excel/xichart.cxx8
-rw-r--r--sc/source/filter/excel/xlchart.cxx3
-rw-r--r--sc/source/filter/excel/xlstyle.cxx1
-rw-r--r--sc/source/filter/inc/xlchart.hxx1
61 files changed, 2231 insertions, 167 deletions
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index 4b44b2e0593d..3d930f72f0af 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -177,6 +177,17 @@ sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis(
, Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
}
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
+ const Reference< chart2::XDataSeries >& xSeries )
+{
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ),
+ xSeries,
+ -1 /*-1 for whole series*/,
+ ChartModelHelper::findDiagram( m_xChartModel )
+ );
+}
+
//-----------------------------------------------------------------------------
awt::Size Chart2ModelContact::GetPageSize() const
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index b8ce668dff28..0cc8a16bafff 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XTitle.hpp>
#include <cppuhelper/weakref.hxx>
@@ -87,6 +88,9 @@ public:
sal_Int32 getExplicitNumberFormatKeyForAxis(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+ sal_Int32 getExplicitNumberFormatKeyForSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
+
/** Returns the size of the page in logic coordinates. This value is used
for setting an appropriate "ReferencePageSize" for FontHeights.
*/
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 3e3b7254f578..fcc17fefeebc 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -98,6 +98,7 @@ enum eServiceType
SERVICE_NAME_PIE_DIAGRAM,
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
+ SERVICE_NAME_BUBBLE_DIAGRAM,
SERVICE_NAME_DASH_TABLE,
SERVICE_NAME_GARDIENT_TABLE,
@@ -126,6 +127,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
( 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 )
+ ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM )
( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE )
( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE )
@@ -1367,6 +1369,16 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
}
break;
+ case SERVICE_NAME_BUBBLE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
case SERVICE_NAME_DASH_TABLE:
case SERVICE_NAME_GARDIENT_TABLE:
case SERVICE_NAME_HATCH_TABLE:
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index a6c18f9475dc..ce417155dc4f 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -50,6 +50,7 @@
#include "WrappedDataCaptionProperties.hxx"
#include "WrappedSeriesAreaOrLineProperty.hxx"
#include "WrappedScaleTextProperties.hxx"
+#include "WrappedNumberFormatProperty.hxx"
#include "WrappedTextRotationProperty.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
@@ -88,6 +89,7 @@ enum
PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
PROP_SERIES_NUMBERFORMAT,
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
//other series properties
@@ -165,6 +167,13 @@ void lcl_AddPropertiesToVector_SeriesOnly(
::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
}
const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
@@ -713,6 +722,10 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
{
WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
+
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
}
WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 5bd12775fbcd..fe1359aab7f3 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -549,6 +549,9 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
if( aName.indexOf( C2U("Stock") ) != -1 )
return C2U( "com.sun.star.chart.StockDiagram" );
+ if( aName.indexOf( C2U("Bubble") ) != -1 )
+ return C2U( "com.sun.star.chart.BubbleDiagram" );
+
// Note: this must be checked after Bar, Net and Scatter
// "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
@@ -594,6 +597,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
, ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
+
;
return g_aChartTypeNameMap;
}
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
index 4110a6ef3b54..00101ef10f34 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -98,8 +98,15 @@ Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XProp
Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
if( !aRet.hasValue() )
{
- Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
- sal_Int32 nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ sal_Int32 nKey = 0;
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
+ if( xSeries.is() )
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
+ else
+ {
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ }
aRet <<= nKey;
}
return aRet;
diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc
index 58b1d540cc1a..07ed2eeec0d5 100644
--- a/chart2/source/controller/dialogs/Bitmaps.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps.hrc
@@ -34,23 +34,28 @@
#include <svtools/solar.hrc>
#endif
-// next free: 100
-
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
#endif
//-----------------------------------------------------------------------------
// chart types
+// Images:
#define IMG_TYPE_COLUMN (RID_APP_START + 1)
#define IMG_TYPE_BAR (RID_APP_START + 2)
#define IMG_TYPE_PIE (RID_APP_START + 3)
-#define IMG_TYPE_LINE (RID_APP_START + 4)
-#define IMG_TYPE_AREA (RID_APP_START + 5)
-#define IMG_TYPE_NET (RID_APP_START + 6)
-#define IMG_TYPE_STOCK (RID_APP_START + 7)
-#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 8)
+#define IMG_TYPE_AREA (RID_APP_START + 4)
+#define IMG_TYPE_LINE (RID_APP_START + 5)
+#define IMG_TYPE_XY (RID_APP_START + 6)
+#define IMG_TYPE_BUBBLE (RID_APP_START + 7)
+#define IMG_TYPE_NET (RID_APP_START + 8)
+#define IMG_TYPE_STOCK (RID_APP_START + 9)
+#define IMG_TYPE_COLUMN_LINE (RID_APP_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
//----------------------
// Column Chart Subtypes
@@ -185,7 +190,13 @@
#define BMP_COLUMN_LINE (RID_APP_START + 86)
#define BMP_COLUMN_LINE_STACKED (RID_APP_START + 87)
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1 (RID_APP_START + 88)
+
//-----------------------------------------------------------------------------
+//further Images:
+
//SchStatisticTabPage and SchDataStatisticsDlg part 1
#define BMP_INDICATE_BOTH_VERTI (RID_APP_START + 89)
#define BMP_INDICATE_UP (RID_APP_START + 90)
@@ -201,9 +212,8 @@
#define BMP_REGRESSION_EXP (RID_APP_START + 95)
#define BMP_REGRESSION_POWER (RID_APP_START + 96)
-//-----------------------------------------------------------------------------
// hide-button for range-choosing
-#define IMG_SELECTRANGE (RID_APP_START + 9)
+#define IMG_SELECTRANGE (RID_APP_START + 100)
// CHART_BITMAPS_HRC
#endif
diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src
index 2af607b6963c..35a897848fb1 100644
--- a/chart2/source/controller/dialogs/Bitmaps.src
+++ b/chart2/source/controller/dialogs/Bitmaps.src
@@ -49,6 +49,11 @@ Image IMG_TYPE_LINE
ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
MaskColor = STD_MASKCOLOR;
};
+Image IMG_TYPE_XY
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
Image IMG_TYPE_AREA
{
ImageBitmap = Bitmap { File = "typearea_16.png" ; };
@@ -69,6 +74,15 @@ Image IMG_TYPE_COLUMN_LINE
ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
MaskColor = STD_MASKCOLOR;
};
+Image IMG_TYPE_BUBBLE
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = STD_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1
+{
+ File = "bubble_52x60.png" ;
+};
Bitmap BMP_AREAS_2D
{
File = "areas_52x60.png" ;
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
index 0b65579973c5..84a23ba426bc 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.hrc
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc
@@ -41,15 +41,22 @@
//-----------------------------------------------------------------------------
// chart types
+// Images:
#define IMG_TYPE_COLUMN_HC (RID_SCH_START + 1)
#define IMG_TYPE_BAR_HC (RID_SCH_START + 2)
#define IMG_TYPE_PIE_HC (RID_SCH_START + 3)
-#define IMG_TYPE_LINE_HC (RID_SCH_START + 4)
-#define IMG_TYPE_AREA_HC (RID_SCH_START + 5)
-#define IMG_TYPE_NET_HC (RID_SCH_START + 6)
-#define IMG_TYPE_STOCK_HC (RID_SCH_START + 7)
-#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 8)
+#define IMG_TYPE_AREA_HC (RID_SCH_START + 4)
+#define IMG_TYPE_LINE_HC (RID_SCH_START + 5)
+#define IMG_TYPE_XY_HC (RID_SCH_START + 6)
+#define IMG_TYPE_BUBBLE_HC (RID_SCH_START + 7)
+#define IMG_TYPE_NET_HC (RID_SCH_START + 8)
+#define IMG_TYPE_STOCK_HC (RID_SCH_START + 9)
+#define IMG_TYPE_COLUMN_LINE_HC (RID_SCH_START + 10)
+
+//-----------------------------------------------------------------------------
+//Chart Subtypes
+// Bitmaps:
//----------------------
// Column Chart Subtypes
@@ -183,7 +190,13 @@
#define BMP_COLUMN_LINE_HC (RID_SCH_START + 86)
#define BMP_COLUMN_LINE_STACKED_HC (RID_SCH_START + 87)
+//----------------------
+// Bubble Chart Subtypes
+#define BMP_BUBBLE_1_HC (RID_SCH_START + 88)
+
//-----------------------------------------------------------------------------
+//further Images:
+
//SchStatisticTabPage and SchDataStatisticsDlg part 1
#define BMP_INDICATE_BOTH_VERTI_HC (RID_SCH_START + 89)
#define BMP_INDICATE_UP_HC (RID_SCH_START + 90)
@@ -199,6 +212,5 @@
#define BMP_REGRESSION_EXP_HC (RID_SCH_START + 95)
#define BMP_REGRESSION_POWER_HC (RID_SCH_START + 96)
-//-----------------------------------------------------------------------------
// hide-button for range-choosing
-#define IMG_SELECTRANGE_HC (RID_SCH_START + 9)
+#define IMG_SELECTRANGE_HC (RID_SCH_START + 100)
diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src
index 1e2fe5f4ba14..0fb7ef5e5a1a 100644
--- a/chart2/source/controller/dialogs/Bitmaps_HC.src
+++ b/chart2/source/controller/dialogs/Bitmaps_HC.src
@@ -49,6 +49,11 @@ Image IMG_TYPE_LINE_HC
ImageBitmap = Bitmap { File = "typepointline_16.png" ; };
MaskColor = SC_HC_MASKCOLOR;
};
+Image IMG_TYPE_XY_HC
+{
+ ImageBitmap = Bitmap { File = "typexy_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
Image IMG_TYPE_AREA_HC
{
ImageBitmap = Bitmap { File = "typearea_16.png" ; };
@@ -69,6 +74,15 @@ Image IMG_TYPE_COLUMN_LINE_HC
ImageBitmap = Bitmap { File = "typecolumnline_16.png" ; };
MaskColor = SC_HC_MASKCOLOR;
};
+Image IMG_TYPE_BUBBLE_HC
+{
+ ImageBitmap = Bitmap { File = "typebubble_16.png" ; };
+ MaskColor = SC_HC_MASKCOLOR;
+};
+Bitmap BMP_BUBBLE_1_HC
+{
+ File = "bubble_52x60_h.png" ;
+};
Bitmap BMP_AREAS_2D_HC
{
File = "areas_52x60_h.png" ;
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 79efe0b04919..de57e82e58da 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -808,7 +808,7 @@ String XYChartDialogController::getName()
}
Image XYChartDialogController::getImage( bool bIsHighContrast )
{
- return SELECT_IMAGE( IMG_TYPE_LINE );
+ return SELECT_IMAGE( IMG_TYPE_XY );
}
const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
{
@@ -1238,6 +1238,40 @@ void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypePa
break;
}
}
+//--------------------------------------------------------------------------
+BubbleChartDialogController::BubbleChartDialogController()
+{
+}
+BubbleChartDialogController::~BubbleChartDialogController()
+{
+}
+String BubbleChartDialogController::getName()
+{
+ return String( SchResId( STR_TYPE_BUBBLE ));
+}
+Image BubbleChartDialogController::getImage( bool bIsHighContrast )
+{
+ return SELECT_IMAGE( IMG_TYPE_BUBBLE );
+}
+const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
+{
+ static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
+ tTemplateServiceChartTypeParameterMap
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), ChartTypeParameter(1,true) ) ;
+ return m_aTemplateMap;
+}
+void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& /*rParameter*/ )
+{
+ rSubTypeList.Clear();
+ rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_BUBBLE_1 ) );
+
+ rSubTypeList.SetItemText( 1, String( SchResId( STR_BUBBLE_1 )) );
+}
+void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
+{
+ rParameter.b3DLook = false;
+ rParameter.eStackMode = GlobalStackMode_NONE;
+}
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
index 0f6c7a8ae2c0..cdbda807813f 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -301,6 +301,19 @@ private:
MetricField* m_pMF_NumberOfLines;
};
+class BubbleChartDialogController : public ChartTypeDialogController
+{
+public:
+ BubbleChartDialogController();
+ virtual ~BubbleChartDialogController();
+
+ virtual String getName();
+ virtual Image getImage( bool bIsHighContrast );
+ virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const;
+ virtual void fillSubTypeList( ValueSet& rSubTypeList, bool bIsHighContrast, const ChartTypeParameter& rParameter );
+ virtual void adjustParameterToSubType( ChartTypeParameter& rParameter );
+};
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index cf61b88a63ac..0a9b58758de6 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -407,8 +407,7 @@ Image SeriesHeader::GetChartTypeImage(
}
else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ))
{
- // @todo: correct image for scatter chart type
- aResult = SELECT_IMAGE( IMG_TYPE_LINE, bHC );
+ aResult = SELECT_IMAGE( IMG_TYPE_XY, bHC );
}
else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_PIE ))
{
@@ -423,6 +422,10 @@ Image SeriesHeader::GetChartTypeImage(
// @todo: correct image for candle-stick type
aResult = SELECT_IMAGE( IMG_TYPE_STOCK, bHC );
}
+ else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ))
+ {
+ aResult = SELECT_IMAGE( IMG_TYPE_BUBBLE, bHC );
+ }
return aResult;
}
@@ -1068,6 +1071,7 @@ sal_Bool DataBrowser::IsTabAllowed( sal_Bool bForward ) const
if( CellContainsNumbers( nRow, nCol ))
{
+ m_aNumberEditField.UseInputStringForFormatting();
m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
return m_rNumberEditController;
}
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index e612edc0901b..1db67c6721af 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -41,6 +41,8 @@
#include "macros.hxx"
#include "StatisticsHelper.hxx"
#include "ContainerHelper.hxx"
+#include "ChartTypeHelper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
@@ -329,6 +331,8 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
Reference< chart2::XDataSeries > xSeries;
if( static_cast< tDataColumnVector::size_type >( nAfterColumnIndex ) <= m_aColumns.size())
xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+
+ sal_Int32 nSeriesNumberFormat = 0;
if( xSeries.is())
{
xChartType.set( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ));
@@ -337,6 +341,10 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
lcl_DataSeriesOfHeaderMatches( xSeries )));
if( aIt != m_aHeaders.end())
nStartCol = aIt->m_nEndColumn;
+
+ Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY );
+ if( xSeriesProps.is() )
+ xSeriesProps->getPropertyValue( C2U( "NumberFormat" )) >>= nSeriesNumberFormat;
}
else
{
@@ -404,6 +412,14 @@ void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex )
}
}
}
+ if( nSeriesNumberFormat != 0 )
+ {
+ //give the new series the same number format as the former series especially for bubble charts thus the bubble size values can be edited with same format immidiately
+ Reference< beans::XPropertySet > xNewSeriesProps( xNewSeries, uno::UNO_QUERY );
+ if( xNewSeriesProps.is() )
+ xNewSeriesProps->setPropertyValue( C2U( "NumberFormat" ), uno::makeAny( nSeriesNumberFormat ) );
+ }
+
updateFromModel();
}
}
@@ -724,11 +740,15 @@ void DataBrowserModel::updateFromModel()
{
Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( 0, aCooSysSeq[nCooSysIdx], 0, 0 );
+
for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
{
Reference< chart2::XDataSeriesContainer > xSeriesCnt( aChartTypes[nCTIdx], uno::UNO_QUERY );
if( xSeriesCnt.is())
{
+ rtl::OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] );
+
Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries());
lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries ));
for( lcl_tSharedSeqVec::const_iterator aIt( aSharedSequences.begin());
@@ -741,16 +761,15 @@ void DataBrowserModel::updateFromModel()
// as the sequences are shared it should be ok to take the first series
// @todo: dimension index 0 for x-values used here. This is just a guess.
// Also, the axis index is 0, as there is usually only one x-axis
- aSharedSequence.m_nNumberFormatKey =
- DataSeriesHelper::getNumberFormatKeyFromAxis(
- aSeries[0], aCooSysSeq[nCooSysIdx], 0, 0 );
+ aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
m_aColumns.push_back( aSharedSequence );
++nHeaderStart;
}
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx )
{
tDataColumnVector::size_type nStartColIndex = m_aColumns.size();
- Reference< chart2::data::XDataSource > xSource( aSeries[nSeriesIdx], uno::UNO_QUERY );
+ Reference< chart2::XDataSeries > xSeries( aSeries[nSeriesIdx] );
+ Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
if( xSource.is())
{
Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
@@ -768,9 +787,14 @@ void DataBrowserModel::updateFromModel()
{
sal_Int32 nSequenceNumberFormatKey = nYAxisNumberFormatKey;
OUString aRole = lcl_getRole( aLSeqs[nSeqIdx] );
- if( aRole.equals( C2U( "values-x" ) ) )
- nSequenceNumberFormatKey = DataSeriesHelper::getNumberFormatKeyFromAxis(
- aSeries[nSeriesIdx], aCooSysSeq[nCooSysIdx], 0, 0 );
+
+ if( aRole.equals( aRoleForDataLabelNumberFormat ) )
+ {
+ nSequenceNumberFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ), xSeries, -1, xDiagram );
+ }
+ else if( aRole.equals( C2U( "values-x" ) ) )
+ nSequenceNumberFormatKey = nXAxisNumberFormat;
if( ::std::find_if( aSharedSequences.begin(), aSharedSequences.end(),
lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) == aSharedSequences.end())
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 1a7e8675f5bc..69e693911c22 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -108,6 +108,7 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
aTranslationMap[ C2U( "values-min" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_MIN )));
aTranslationMap[ C2U( "values-x" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_X )));
aTranslationMap[ C2U( "values-y" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_Y )));
+ aTranslationMap[ C2U( "values-size" ) ] = OUString( String( ::chart::SchResId( STR_DATA_ROLE_SIZE )));
}
if( bFromInternalToUI )
@@ -155,6 +156,7 @@ void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap )
rOutMap[ C2U( "values-min" ) ] = ++nIndex;
rOutMap[ C2U( "values-max" ) ] = ++nIndex;
rOutMap[ C2U( "values-last" ) ] = ++nIndex;
+ rOutMap[ C2U( "values-size" ) ] = ++nIndex;
}
struct lcl_DataSeriesContainerAppend : public
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 7ee4ae67761d..1ed974814ea7 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -109,7 +109,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
- rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last;
+ rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
double fValue = 0;
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
@@ -170,6 +170,12 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
aY_Last = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
}
+ else if( aRole.equals(C2U("values-size")) )
+ {
+ aData[nPointIndex]>>= fValue;
+ sal_Int32 nNumberFormatKey = xDataSequence->getNumberFormatKeyByIndex( nPointIndex );
+ a_Size = aNumberFormatterWrapper.getFormattedString( nNumberFormatKey, fValue, nLabelColor, bColorChanged );
+ }
}
catch( uno::Exception& e )
{
@@ -201,6 +207,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
lcl_addText( aRet, aSeparator, aY_Min );
lcl_addText( aRet, aSeparator, aY_Max );
lcl_addText( aRet, aSeparator, aY_Last );
+ lcl_addText( aRet, aSeparator, a_Size );
return aRet;
}
diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src
index b08fe754513f..3b384915f2d0 100644
--- a/chart2/source/controller/dialogs/Strings.src
+++ b/chart2/source/controller/dialogs/Strings.src
@@ -471,6 +471,11 @@ String STR_DATA_ROLE_Y
Text [ en-US ] = "Y-Values" ;
};
+String STR_DATA_ROLE_SIZE
+{
+ Text [ en-US ] = "Bubble Sizes" ;
+};
+
String STR_DATA_ROLE_X_ERROR
{
Text [ en-US ] = "X-Error-Bars" ;
diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src
index 1e18f0e8724f..2234f04a3fcd 100644
--- a/chart2/source/controller/dialogs/Strings_ChartTypes.src
+++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src
@@ -140,4 +140,13 @@ String STR_DEEP
Text [ en-US ] = "Deep" ;
};
//-----------------------------------------------------------------------------
+String STR_TYPE_BUBBLE
+{
+ Text [ en-US ] = "Bubble" ;
+};
+String STR_BUBBLE_1
+{
+ Text [ en-US ] = "Bubble Chart" ;
+};
+//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index a93711151ac1..c6129629a51a 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -215,6 +215,13 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt
m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
+ if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
+ if( bForbidPercentValue )
+ m_aCBPercent.Enable(false);
+ }
+
m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
}
@@ -286,14 +293,14 @@ IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
void DataLabelResources::EnableControls()
{
- m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
+ m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
//enable separator
{
long nNumberOfCheckedLabelParts = 0;
if( m_aCBNumber.IsChecked() )
++nNumberOfCheckedLabelParts;
- if( m_aCBPercent.IsChecked() )
+ if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
++nNumberOfCheckedLabelParts;
if( m_aCBCategory.IsChecked() )
++nNumberOfCheckedLabelParts;
@@ -307,7 +314,7 @@ void DataLabelResources::EnableControls()
}
m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
- m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() );
+ m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
m_aFL_Rotate.Enable( bEnableRotation );
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index f60637af4c44..b2d64400ef98 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -862,6 +862,7 @@ ChartTypeTabPage::ChartTypeTabPage( Window* pParent
m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
+ m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx
index a59170f4d699..4eec81bd20b5 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -103,6 +103,7 @@ private:
sal_Int32 m_nNumberFormat;
sal_Int32 m_nPercentNumberFormat;
::com::sun::star::uno::Sequence< sal_Int32 > m_aAvailableLabelPlacements;
+ bool m_bForbidPercentValue;
};
} // namespace wrapper
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 0c0ea2d0dbdd..af062cf3b93c 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -239,7 +239,8 @@ DataPointItemConverter::DataPointItemConverter(
m_nSpecialFillColor(nSpecialFillColor),
m_nNumberFormat(nNumberFormat),
m_nPercentNumberFormat(nPercentNumberFormat),
- m_aAvailableLabelPlacements()
+ m_aAvailableLabelPlacements(),
+ m_bForbidPercentValue(true)
{
m_aConverters.push_back( new GraphicPropertyItemConverter(
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
@@ -257,6 +258,8 @@ DataPointItemConverter::DataPointItemConverter(
bool bAmbiguous = false;
sal_Bool bSwapXAndY = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
m_aAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements( xChartType, DiagramHelper::getDimension( xDiagram ), bSwapXAndY, xSeries );
+
+ m_bForbidPercentValue = AxisType::CATEGORY != ChartTypeHelper::getAxisType( xChartType, 0 );
}
DataPointItemConverter::~DataPointItemConverter()
@@ -648,6 +651,12 @@ void DataPointItemConverter::FillSpecialItem(
}
break;
+ case SCHATTR_DATADESCR_NO_PERCENTVALUE:
+ {
+ rOutItemSet.Put( SfxBoolItem( nWhichId, m_bForbidPercentValue ));
+ }
+ break;
+
case SCHATTR_STYLE_SYMBOL:
{
chart2::Symbol aSymbol;
diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
index 9f300e8febc1..4b626e1be839 100644
--- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
+++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
@@ -141,9 +141,8 @@ AllDataLabelItemConverter::AllDataLabelItemConverter(
uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
uno::Reference< uno::XComponentContext> xContext(0);//do not need Context for label properties
- sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForLabel( xObjectProperties, *aIt, -1/*nPointIndex*/,
- uno::Reference< beans::XPropertySet >( DiagramHelper::getAttachedAxis( *aIt, ChartModelHelper::findDiagram( xChartModel ) ), uno::UNO_QUERY ) );
- sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, *aIt, -1/*nPointIndex*/, ChartModelHelper::findDiagram( xChartModel ) );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index 0321df6035f2..dbefb0e7f025 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -128,8 +128,6 @@ const USHORT nDataLabelWhichPairs[] =
SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */ \
SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \
SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 sch/schattr.hxx*/ \
- SCHATTR_DATADESCR_PLACEMENT, SCHATTR_DATADESCR_PLACEMENT,
- SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,
SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES,
EE_PARA_WRITINGDIR,EE_PARA_WRITINGDIR,
0
@@ -145,8 +143,6 @@ const USHORT nDataLabelWhichPairs[] =
SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */ \
SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \
SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 sch/schattr.hxx*/ \
- SCHATTR_DATADESCR_PLACEMENT, SCHATTR_DATADESCR_PLACEMENT, \
- SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, \
SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, \
SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/ \
SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 94 sch/schattr.hxx*/ \
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 3b5b3d6fa7ba..530cd6f0aeb8 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -240,9 +240,8 @@ namespace
}
}
}
- sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForLabel( xObjectProperties, xSeries, nPointIndex,
- uno::Reference< beans::XPropertySet >( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY ) );
- sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+ sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties, xSeries, nPointIndex, xDiagram );
+ sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
xObjectProperties,uno::Reference< util::XNumberFormatsSupplier >(xChartModel, uno::UNO_QUERY));
pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext,
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx
index efa4758c4ccd..e46aaa5406a5 100644
--- a/chart2/source/inc/ChartTypeHelper.hxx
+++ b/chart2/source/inc/ChartTypeHelper.hxx
@@ -86,6 +86,15 @@ public:
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 );
+
+ static rtl::OUString getRoleOfSequenceForYAxisNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static rtl::OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
+
+ static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartType );
};
//.............................................................................
diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc
index 0af8f7e1ae04..133f5bcc255b 100644
--- a/chart2/source/inc/Strings.hrc
+++ b/chart2/source/inc/Strings.hrc
@@ -33,8 +33,8 @@
// this includes no link dependency
#include <svtools/solar.hrc>
+//next free is 285
//single free is: 134
-//next free is 282
//#define RID_APP_START 30000
////#define STR_NULL (RID_APP_START + 1)
@@ -129,6 +129,9 @@
#define STR_STOCK_3 (RID_APP_START + 145)
#define STR_STOCK_4 (RID_APP_START + 146)
+#define STR_TYPE_BUBBLE (RID_APP_START + 282)
+#define STR_BUBBLE_1 (RID_APP_START + 283)
+
//-----------------------------------------------------------------------------
//additional controls for wizard:
@@ -181,6 +184,7 @@
#define STR_DATA_ROLE_MIN (RID_APP_START + 248)
#define STR_DATA_ROLE_MAX (RID_APP_START + 249)
#define STR_DATA_ROLE_CATEGORIES (RID_APP_START + 260)
+#define STR_DATA_ROLE_SIZE (RID_APP_START + 284)
#define STR_DATA_UNNAMED_SERIES (RID_APP_START + 250)
#define STR_DATA_UNNAMED_SERIES_WITH_INDEX (RID_APP_START + 251)
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index d1a738d84e94..e4afc0d9efbd 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -51,7 +51,8 @@
#define SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 4)
#define SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 5)
#define SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 6)
-#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS
+#define SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 7) //percentage values should not be offered
+#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_NO_PERCENTVALUE
#define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1)
#define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index 2f96bed91fa5..ab94e7e1c337 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/drawing/XShape.hpp>
@@ -94,13 +95,13 @@ public:
SAL_DLLPRIVATE static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference<
::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
- static sal_Int32 getExplicitNumberFormatKeyForLabel(
+ static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
, sal_Int32 nPointIndex /*-1 for whole series*/
- , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAttachedAxisProps );
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
- static sal_Int32 getExplicitPercentageNumberFormatKeyForLabel(
+ static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
};
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 461483b46e0d..1c2782de3852 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -43,6 +43,7 @@ namespace chart
#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_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")
+#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType")
//.............................................................................
} //namespace chart
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
new file mode 100644
index 000000000000..09e629462d48
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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 "BubbleChartType.hxx"
+#include "PropertyHelper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "AxisHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/AxisType.hpp>
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+using namespace ::com::sun::star;
+
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartType::BubbleChartType(
+ const uno::Reference< uno::XComponentContext > & xContext )
+ : ChartType( xContext )
+{
+}
+
+BubbleChartType::BubbleChartType( const BubbleChartType & rOther ) :
+ ChartType( rOther )
+{
+}
+
+BubbleChartType::~BubbleChartType()
+{}
+
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL BubbleChartType::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new BubbleChartType( *this ));
+}
+
+// ____ XChartType ____
+Reference< chart2::XCoordinateSystem > SAL_CALL
+ BubbleChartType::createCoordinateSystem( ::sal_Int32 DimensionCount )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ Reference< chart2::XCoordinateSystem > xResult(
+ new CartesianCoordinateSystem(
+ GetComponentContext(), DimensionCount, /* bSwapXAndYAxis */ sal_False ));
+
+ for( sal_Int32 i=0; i<DimensionCount; ++i )
+ {
+ Reference< chart2::XAxis > xAxis( xResult->getAxisByDimension( i, MAIN_AXIS_INDEX ) );
+ if( !xAxis.is() )
+ {
+ OSL_ENSURE(false,"a created coordinate system should have an axis for each dimension");
+ continue;
+ }
+
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ aScaleData.Orientation = chart2::AxisOrientation_MATHEMATICAL;
+ aScaleData.Scaling = AxisHelper::createLinearScaling();
+
+ if( i == 2 )
+ aScaleData.AxisType = chart2::AxisType::SERIES;
+ else
+ aScaleData.AxisType = chart2::AxisType::REALNUMBER;
+
+ xAxis->setScaleData( aScaleData );
+ }
+
+ return xResult;
+}
+
+::rtl::OUString SAL_CALL BubbleChartType::getChartType()
+ throw (uno::RuntimeException)
+{
+ return CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL BubbleChartType::getSupportedMandatoryRoles()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< ::rtl::OUString > aMandRolesSeq;
+
+ if( aMandRolesSeq.getLength() == 0 )
+ {
+ aMandRolesSeq.realloc( 4 );
+ aMandRolesSeq[0] = C2U( "label" );
+ aMandRolesSeq[1] = C2U( "values-x" );
+ aMandRolesSeq[2] = C2U( "values-y" );
+ aMandRolesSeq[3] = C2U( "values-size" );
+ }
+
+ return aMandRolesSeq;
+}
+
+OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
+ throw (uno::RuntimeException)
+{
+ return C2U( "values-size" );
+}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartType::GetDefaultValue( sal_Int32 nHandle ) const
+ throw(beans::UnknownPropertyException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ // initialize defaults
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ }
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+ // \--
+}
+
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+uno::Sequence< ::rtl::OUString > BubbleChartType::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 3 );
+ aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE;
+ 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( BubbleChartType,
+ C2U( "com.sun.star.comp.chart.BubbleChartType" ));
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartType.hxx b/chart2/source/model/template/BubbleChartType.hxx
new file mode 100644
index 000000000000..3694ac1c955c
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartType.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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_BUBBLECHARTTYPE_HXX
+#define CHART_BUBBLECHARTTYPE_HXX
+
+#include "ChartType.hxx"
+#include "ServiceMacros.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+
+namespace chart
+{
+
+class BubbleChartType : public ChartType
+{
+public:
+ BubbleChartType(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext );
+ virtual ~BubbleChartType();
+
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// establish methods for factory instatiation
+ APPHELPER_SERVICE_FACTORY_HELPER( BubbleChartType )
+
+protected:
+ explicit BubbleChartType( const BubbleChartType & rOther );
+
+ // ____ XChartType ____
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedMandatoryRoles()
+ 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,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getRoleOfSequenceForSeriesLabel()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ OPropertySet ____
+ 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);
+
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
new file mode 100644
index 000000000000..0853cea6a5cb
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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 "BubbleChartTypeTemplate.hxx"
+#include "macros.hxx"
+#include "BubbleDataInterpreter.hxx"
+#include "CartesianCoordinateSystem.hxx"
+#include "Scaling.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include "PropertyHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.BubbleChartTypeTemplate" ));
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & /*rOutProperties*/ )
+{
+}
+
+void lcl_AddDefaultsToMap(
+ ::chart::tPropertyValueMap & /*rOutMap*/ )
+{
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ 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;
+}
+
+::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper aArrayHelper(
+ lcl_GetPropertySequence(),
+ /* bSorted = */ sal_True );
+
+ return aArrayHelper;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+
+BubbleChartTypeTemplate::BubbleChartTypeTemplate(
+ Reference<
+ uno::XComponentContext > const & xContext,
+ const OUString & rServiceName ) :
+ ChartTypeTemplate( xContext, rServiceName ),
+ ::property::OPropertySet( m_aMutex )
+{
+}
+
+BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
+{}
+
+// ____ OPropertySet ____
+uno::Any BubbleChartTypeTemplate::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;
+ // \--
+}
+
+::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
+{
+ return lcl_getInfoHelper();
+}
+
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ BubbleChartTypeTemplate::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is())
+ {
+ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
+ getInfoHelper());
+ }
+
+ return xInfo;
+ // \--
+}
+
+sal_Int32 BubbleChartTypeTemplate::getDimension() const
+{
+ return 2;
+}
+
+StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) const
+{
+ return StackMode_NONE;
+}
+
+bool BubbleChartTypeTemplate::supportsCategories() const
+{
+ return false;
+}
+
+
+void SAL_CALL BubbleChartTypeTemplate::applyStyle(
+ const Reference< chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (uno::RuntimeException)
+{
+ ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XChartTypeTemplate ____
+Sequence< OUString > SAL_CALL BubbleChartTypeTemplate::getAvailableCreationParameterNames()
+ throw (uno::RuntimeException)
+{
+ return Sequence< OUString >();
+}
+
+sal_Bool SAL_CALL BubbleChartTypeTemplate::matchesTemplate(
+ const Reference< chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties );
+
+ if( bResult )
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+
+ for( ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+
+ // adapt curve style, spline order and resolution
+ if( bResult && bAdaptProperties )
+ {
+ try
+ {
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return bResult;
+}
+
+Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+{
+ Reference< chart2::XChartType > xResult;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XChartType > SAL_CALL BubbleChartTypeTemplate::getChartTypeForNewSeries(
+ const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (uno::RuntimeException)
+{
+ Reference< chart2::XChartType > xResult;
+
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
+ xResult.set( xFact->createInstance(
+ CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ return xResult;
+}
+
+Reference< chart2::XDataInterpreter > SAL_CALL BubbleChartTypeTemplate::getDataInterpreter()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xDataInterpreter.is())
+ m_xDataInterpreter.set( new BubbleDataInterpreter( GetComponentContext()) );
+
+ return m_xDataInterpreter;
+}
+
+// ----------------------------------------
+
+Sequence< OUString > BubbleChartTypeTemplate::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 2 );
+ aServices[ 0 ] = lcl_aServiceName;
+ aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartTypeTemplate" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( BubbleChartTypeTemplate, lcl_aServiceName );
+
+IMPLEMENT_FORWARD_XINTERFACE2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BubbleChartTypeTemplate, ChartTypeTemplate, OPropertySet )
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
new file mode 100644
index 000000000000..c094e38e28ac
--- /dev/null
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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_BUBBLECHARTTYPETEMPLATE_HXX
+#define CHART_BUBBLECHARTTYPETEMPLATE_HXX
+
+#include "ChartTypeTemplate.hxx"
+#include "OPropertySet.hxx"
+#include "MutexContainer.hxx"
+#include <comphelper/uno3.hxx>
+
+namespace chart
+{
+
+class BubbleChartTypeTemplate :
+ public MutexContainer,
+ public ChartTypeTemplate,
+ public ::property::OPropertySet
+{
+public:
+ explicit BubbleChartTypeTemplate(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ const ::rtl::OUString & rServiceName );
+ virtual ~BubbleChartTypeTemplate();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ /// merge XInterface implementations
+ DECLARE_XINTERFACE()
+ /// merge XTypeProvider implementations
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ // ____ OPropertySet ____
+ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw(::com::sun::star::beans::UnknownPropertyException);
+ 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);
+
+ // ____ XChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableCreationParameterNames()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
+ getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL applyStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
+ ::sal_Int32 nChartTypeGroupIndex,
+ ::sal_Int32 nSeriesIndex,
+ ::sal_Int32 nSeriesCount )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ ChartTypeTemplate ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
+ getChartTypeForIndex( sal_Int32 nChartTypeIndex );
+ virtual sal_Int32 getDimension() const;
+ virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
+
+ virtual bool supportsCategories() const;
+};
+
+} // namespace chart
+
+// CHART_BUBBLECHARTTYPETEMPLATE_HXX
+#endif
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
new file mode 100644
index 000000000000..a5ebb6b1ec2f
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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 "BubbleDataInterpreter.hxx"
+#include "DataSeries.hxx"
+#include "macros.hxx"
+#include "DataSeriesHelper.hxx"
+#include "CommonConverters.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::std;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+BubbleDataInterpreter::BubbleDataInterpreter(
+ const uno::Reference< uno::XComponentContext > & xContext ) :
+ DataInterpreter( xContext )
+{
+}
+
+BubbleDataInterpreter::~BubbleDataInterpreter()
+{
+}
+
+// ____ XDataInterpreter ____
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
+ const Reference< chart2::data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ throw (uno::RuntimeException)
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+ Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xValuesX;
+ vector< Reference< data::XLabeledDataSequence > > aYValuesVector;
+ vector< Reference< data::XLabeledDataSequence > > aSizeValuesVector;
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ bool bHasCategories = HasCategories( aArguments, aData );
+
+ Sequence< Reference< data::XLabeledDataSequence > > aUnusedData;
+
+ bool bHasXValues = false;
+ sal_Int32 nDataSeqCount = aData.getLength();
+
+ bHasXValues = bHasCategories ? ( (nDataSeqCount-1) > 2 && (nDataSeqCount-1) % 2 != 0 )
+ :( nDataSeqCount > 2 && nDataSeqCount % 2 != 0 );
+
+ bool bCategoriesUsed = false;
+ bool bNextIsYValues = bHasCategories ? nDataSeqCount>2 : nDataSeqCount>1;
+ for( sal_Int32 nDataIdx = 0; nDataIdx < aData.getLength(); ++nDataIdx )
+ {
+ try
+ {
+ if( bHasCategories && !bCategoriesUsed )
+ {
+ xCategories.set( aData[nDataIdx] );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), C2U("categories"));
+ bCategoriesUsed = true;
+ }
+ else if( !xValuesX.is() && bHasXValues )
+ {
+ xValuesX.set( aData[nDataIdx] );
+ if( xValuesX.is())
+ SetRole( xValuesX->getValues(), C2U("values-x"));
+ }
+ else if( bNextIsYValues )
+ {
+ aYValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-y"));
+ bNextIsYValues = false;
+ }
+ else if( !bNextIsYValues )
+ {
+ aSizeValuesVector.push_back( aData[nDataIdx] );
+ if( aData[nDataIdx].is())
+ SetRole( aData[nDataIdx]->getValues(), C2U("values-size"));
+ bNextIsYValues = true;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ // create DataSeries
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSizeValuesVector.size());
+
+ Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
+ Reference< util::XCloneable > xCloneableX( xValuesX, uno::UNO_QUERY );
+
+ for( size_t nCount = 0; nCount < aSizeValuesVector.size(); ++nCount, ++nSeriesIndex )
+ {
+ sal_Int32 nDataSequenceCount = 2;
+ if( xValuesX.is() )
+ nDataSequenceCount = 3;
+ else if( aYValuesVector.empty() )
+ nDataSequenceCount = 1;
+
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( nDataSequenceCount );
+ sal_Int32 nDataIndex = 0;
+ if( xValuesX.is() )
+ {
+ if( nCount > 0 && xCloneableX.is() )
+ xClonedXValues.set( xCloneableX->createClone(), uno::UNO_QUERY );
+ aNewData[nDataIndex++] = xClonedXValues;
+ }
+ if( aYValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aYValuesVector[nCount];
+ if( aSizeValuesVector.size() > nCount )
+ aNewData[nDataIndex++] = aSizeValuesVector[nCount];
+
+ Reference< XDataSeries > xSeries;
+ if( nSeriesIndex < aSeriesToReUse.getLength())
+ xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ else
+ xSeries.set( new DataSeries( GetComponentContext() ) );
+ OSL_ASSERT( xSeries.is() );
+ Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
+ OSL_ASSERT( xSink.is() );
+ xSink->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ }
+
+ Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
+ aSeries[0] = ContainerHelper::ContainerToSequence( aSeriesVec );
+ return InterpretedData( aSeries, xCategories, aUnusedData );
+}
+
+chart2::InterpretedData SAL_CALL BubbleDataInterpreter::reinterpretDataSeries(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ InterpretedData aResult( aInterpretedData );
+ vector< Reference< data::XLabeledDataSequence > > aUnused(
+ ContainerHelper::SequenceToVector( aInterpretedData.UnusedData ));
+
+ sal_Int32 i=0;
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ const sal_Int32 nCount = aSeries.getLength();
+ for( ; i<nCount; ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSeriesSource( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewSequences;
+
+ Reference< data::XLabeledDataSequence > xValuesSize(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-size"), false ));
+ Reference< data::XLabeledDataSequence > xValuesY(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ Reference< data::XLabeledDataSequence > xValuesX(
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-x"), false ));
+
+ if( ! xValuesX.is() ||
+ ! xValuesY.is() ||
+ ! xValuesSize.is() )
+ {
+ vector< Reference< data::XLabeledDataSequence > > aValueSeqVec(
+ DataSeriesHelper::getAllDataSequencesByRole(
+ xSeriesSource->getDataSequences(), C2U("values"), true ));
+ if( xValuesX.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesX ));
+ if( xValuesY.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesY ));
+ if( xValuesSize.is())
+ aValueSeqVec.erase( find( aValueSeqVec.begin(), aValueSeqVec.end(), xValuesSize ));
+
+ size_t nIndex = 0;
+
+ if( ! xValuesSize.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesSize.set( aValueSeqVec[nIndex++] );
+ if( xValuesSize.is())
+ SetRole( xValuesSize->getValues(), C2U("values-size"));
+ }
+
+ if( ! xValuesY.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesY.set( aValueSeqVec[nIndex++] );
+ if( xValuesY.is())
+ SetRole( xValuesY->getValues(), C2U("values-y"));
+ }
+
+ if( ! xValuesX.is() &&
+ aValueSeqVec.size() > nIndex )
+ {
+ xValuesX.set( aValueSeqVec[nIndex++] );
+ if( xValuesX.is())
+ SetRole( xValuesY->getValues(), C2U("values-x"));
+ }
+ }
+ if( xValuesSize.is())
+ {
+ if( xValuesY.is() )
+ {
+ if( xValuesX.is() )
+ {
+ aNewSequences.realloc(3);
+ aNewSequences[0] = xValuesX;
+ aNewSequences[1] = xValuesY;
+ aNewSequences[2] = xValuesSize;
+ }
+ else
+ {
+ aNewSequences.realloc(2);
+ aNewSequences[0] = xValuesY;
+ aNewSequences[1] = xValuesSize;
+ }
+ }
+ else
+ {
+ aNewSequences.realloc(1);
+ aNewSequences[0] = xValuesSize;
+ }
+ }
+
+ Sequence< Reference< data::XLabeledDataSequence > > aSeqs( xSeriesSource->getDataSequences());
+ if( aSeqs.getLength() != aNewSequences.getLength() )
+ {
+ sal_Int32 j=0;
+ for( ; j<aSeqs.getLength(); ++j )
+ {
+ if( aSeqs[j] != xValuesY &&
+ aSeqs[j] != xValuesX &&
+ aSeqs[j] != xValuesSize )
+ aUnused.push_back( aSeqs[j] );
+ }
+ Reference< data::XDataSink > xSink( xSeriesSource, uno::UNO_QUERY_THROW );
+ xSink->setData( aNewSequences );
+ aResult.UnusedData = ContainerHelper::ContainerToSequence( aUnused );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return aResult;
+}
+
+sal_Bool SAL_CALL BubbleDataInterpreter::isDataCompatible(
+ const chart2::InterpretedData& aInterpretedData )
+ throw (uno::RuntimeException)
+{
+ Sequence< Reference< XDataSeries > > aSeries( FlattenSequence( aInterpretedData.Series ));
+ for( sal_Int32 i=0; i<aSeries.getLength(); ++i )
+ {
+ try
+ {
+ Reference< data::XDataSource > xSrc( aSeries[i], uno::UNO_QUERY_THROW );
+ Sequence< Reference< data::XLabeledDataSequence > > aSeq( xSrc->getDataSequences());
+ if( aSeq.getLength() != 3 )
+ return sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return sal_True;
+}
+
+} // namespace chart
diff --git a/chart2/source/model/template/BubbleDataInterpreter.hxx b/chart2/source/model/template/BubbleDataInterpreter.hxx
new file mode 100644
index 000000000000..a173f801812c
--- /dev/null
+++ b/chart2/source/model/template/BubbleDataInterpreter.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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_BUBBLEDATAINTERPRETER_HXX
+#define CHART_BUBBLEDATAINTERPRETER_HXX
+
+#include "DataInterpreter.hxx"
+
+namespace chart
+{
+
+class BubbleDataInterpreter : public DataInterpreter
+{
+public:
+ explicit BubbleDataInterpreter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext );
+ virtual ~BubbleDataInterpreter();
+
+protected:
+ // ____ XDataInterpreter ____
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL interpretDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xSource,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >& aSeriesToReUse )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::chart2::InterpretedData SAL_CALL reinterpretDataSeries(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDataCompatible(
+ const ::com::sun::star::chart2::InterpretedData& aInterpretedData )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace chart
+
+// CHART_BUBBLEDATAINTERPRETER_HXX
+#endif
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index 6365c08f4403..0e4a3a119a02 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -45,6 +45,7 @@
#include "ScatterChartTypeTemplate.hxx"
#include "StockChartTypeTemplate.hxx"
#include "NetChartTypeTemplate.hxx"
+#include "BubbleChartTypeTemplate.hxx"
#include <cppuhelper/component_context.hxx>
#include <comphelper/InlineContainer.hxx>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
@@ -131,6 +132,7 @@ enum TemplateId
TEMPLATE_STOCKOPENLOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
+ TEMPLATE_BUBBLE,
// TEMPLATE_SURFACE,
// TEMPLATE_ADDIN,
TEMPLATE_NOT_FOUND = 0xffff
@@ -202,6 +204,7 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE )
( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ), TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE )
+ ( C2U( "com.sun.star.chart2.template.Bubble" ), TEMPLATE_BUBBLE )
// ( C2U( "com.sun.star.chart2.template.Surface" ), TEMPLATE_SURFACE )
// ( C2U( "com.sun.star.chart2.template.Addin" ), TEMPLATE_ADDIN )
);
@@ -518,6 +521,11 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
StockChartTypeTemplate::VOL_OPEN_LOW_HI_CLOSE, true ));
break;
+ //BubbleChart
+ case TEMPLATE_BUBBLE:
+ xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
+ break;
+
// case TEMPLATE_SURFACE:
// case TEMPLATE_ADDIN:
// break;
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index b5791baf6c0f..1996cc12830e 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -68,27 +68,6 @@ using ::com::sun::star::uno::Any;
namespace
{
-sal_Int32 lcl_getSeriesLength( const Reference< XDataSeries > & xSeries )
-{
- sal_Int32 nResult = 0;
- try
- {
- Reference< data::XDataSource > xDataSource( xSeries, uno::UNO_QUERY_THROW );
- Sequence< Reference< data::XLabeledDataSequence > > aLabSeq( xDataSource->getDataSequences());
- if( aLabSeq.getLength())
- {
- Reference< data::XDataSequence > xSeq( aLabSeq[0]->getValues());
- if( xSeq.is())
- nResult = xSeq->getData().getLength();
- }
- }
- catch( const uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- return nResult;
-}
-
void lcl_applyDefaultStyle(
const Reference< XDataSeries > & xSeries,
sal_Int32 nIndex,
@@ -347,12 +326,9 @@ void SAL_CALL ChartTypeTemplate::changeDiagramData(
Sequence< Sequence< Reference< XDataSeries > > > aSeriesSeq( aData.Series );
sal_Int32 i, j, nIndex = 0;
- sal_Int32 nFirstSeriesLength = 0;
for( i=0; i<aSeriesSeq.getLength(); ++i )
for( j=0; j<aSeriesSeq[i].getLength(); ++j, ++nIndex )
{
- if( i==0 && j==0 )
- nFirstSeriesLength = lcl_getSeriesLength( aSeriesSeq[0][0] );
if( nIndex >= nFormerSeriesCount )
{
lcl_applyDefaultStyle( aSeriesSeq[i][j], nIndex, xDiagram );
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
index b059eb24957a..6e5960410445 100644
--- a/chart2/source/model/template/_serviceregistration_charttypes.cxx
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -41,6 +41,7 @@
#include "NetChartType.hxx"
#include "PieChartType.hxx"
#include "ScatterChartType.hxx"
+#include "BubbleChartType.hxx"
namespace
{
@@ -110,6 +111,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
, 0
, 0
}
+ ,{
+ ::chart::BubbleChartType::create
+ , ::chart::BubbleChartType::getImplementationName_Static
+ , ::chart::BubbleChartType::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
,{ 0, 0, 0, 0, 0, 0 }
};
diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk
index 0913c42a89e2..ad8fcd552c8d 100644
--- a/chart2/source/model/template/makefile.mk
+++ b/chart2/source/model/template/makefile.mk
@@ -71,6 +71,9 @@ SLOFILES= \
$(SLO)$/PieChartTypeTemplate.obj \
$(SLO)$/ScatterChartType.obj \
$(SLO)$/ScatterChartTypeTemplate.obj \
+ $(SLO)$/BubbleChartType.obj \
+ $(SLO)$/BubbleChartTypeTemplate.obj \
+ $(SLO)$/BubbleDataInterpreter.obj \
$(SLO)$/StockChartTypeTemplate.obj \
$(SLO)$/StockDataInterpreter.obj \
$(SLO)$/XYDataInterpreter.obj \
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index d7bb3a15bdf6..deecf6bfc4d8 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -108,6 +108,8 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference<
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
+ return sal_False;
}
return sal_True;
}
@@ -281,6 +283,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
}
else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
|| aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE)
)
{
aRet.realloc(5);
@@ -509,7 +512,8 @@ sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference<
return AxisType::REALNUMBER;
if(0==nDimensionIndex)//x-axis
{
- if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
return AxisType::REALNUMBER;
return AxisType::CATEGORY;
}
@@ -558,7 +562,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
rtl::OUString aChartTypeName = xChartType->getChartType();
if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) ||
- aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) )
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) ||
+ aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
{
aRet.realloc( 2 );
sal_Int32* pSeq = aRet.getArray();
@@ -604,6 +609,38 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments(
return aRet;
}
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+rtl::OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType )
+{
+ rtl::OUString aRet( C2U( "values-y" ) );
+ if( !xChartType.is() )
+ return aRet;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK)
+ || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ aRet = xChartType->getRoleOfSequenceForSeriesLabel();
+ return aRet;
+}
+
+bool ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( const uno::Reference< XChartType >& xChartType )
+{
+ bool bRet = true;
+ rtl::OUString aChartTypeName = xChartType->getChartType();
+ if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ bRet = false;
+ return bRet;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 1401ab43a159..0b1a17ca7701 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -89,7 +89,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
, m_nKeepAspectRatio(nKeepAspectRatio)
, m_aGivenAspectRatio(rAspectRatio)
- , m_eNanHandling( bCategoryXAxis ? NAN_AS_GAP : NAN_AS_INTERPOLATED )
, m_eCurveStyle(CurveStyle_LINES)
, m_nCurveResolution(20)
, m_nSplineOrder(3)
@@ -103,9 +102,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
PlotterBase::m_pPosHelper = m_pMainPosHelper;
VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
- if( m_bArea )
- m_eNanHandling = NAN_AS_ZERO;
-
try
{
if( m_xChartTypeModelProps.is() )
@@ -234,6 +230,12 @@ bool AreaChart::keepAspectRatio() const
void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
{
+ if( m_bArea && pSeries )
+ {
+ sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
+ if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
+ pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
+ }
if( m_nDimension == 3 && !m_bCategoryXAxis )
{
//3D xy always deep
@@ -351,9 +353,10 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
{
// do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP
- double fFirstY = pSeries->getY( 0 );
- double fLastY = pSeries->getY( VSeriesPlotter::getPointCount() - 1 );
- if( (m_eNanHandling != NAN_AS_GAP) || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
+ double fFirstY = pSeries->getYValue( 0 );
+ double fLastY = pSeries->getYValue( VSeriesPlotter::getPointCount() - 1 );
+ if( (pSeries->getMissingValueTreatment() != ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
{
// connect last point in last polygon with first point in first polygon
::basegfx::B2DRectangle aScaledLogicClipDoubleRect( pPosHelper->getScaledLogicClipDoubleRect() );
@@ -573,13 +576,6 @@ void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >& rZS
}//anonymous namespace
-void AreaChart::impl_maybeReplaceNanWithZero( double& rfValue )
-{
- if( m_eNanHandling == NAN_AS_ZERO &&
- ( ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) ) )
- rfValue = 0.0;
-}
-
//better performance for big data
struct FormerPoint
{
@@ -676,8 +672,7 @@ void AreaChart::createShapes()
pPosHelper = m_pMainPosHelper;
PlotterBase::m_pPosHelper = pPosHelper;
- double fAdd = pSeries->getY( nIndex );
- impl_maybeReplaceNanWithZero( fAdd );
+ double fAdd = pSeries->getYValue( nIndex );
if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
aLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
}
@@ -709,23 +704,6 @@ void AreaChart::createShapes()
if(!pSeries)
continue;
- sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
- switch( nMissingValueTreatment )
- {
- case ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP:
- if( !m_bArea )
- m_eNanHandling = NAN_AS_GAP;
- break;
- case ::com::sun::star::chart::MissingValueTreatment::USE_ZERO:
- m_eNanHandling = NAN_AS_ZERO;
- break;
- case ::com::sun::star::chart::MissingValueTreatment::CONTINUE:
- m_eNanHandling = NAN_AS_INTERPOLATED;
- break;
- default:
- break;
- }
-
/* #i70133# ignore points outside of series length in standard area
charts. Stacked area charts will use missing points as zeros. In
standard charts, pSeriesList contains only one series. */
@@ -745,10 +723,8 @@ void AreaChart::createShapes()
(*aSeriesIter)->m_fLogicZPos = fLogicZ;
//collect data point information (logic coordinates, style ):
- double fLogicX = (*aSeriesIter)->getX(nIndex);
- double fLogicY = (*aSeriesIter)->getY(nIndex);
- impl_maybeReplaceNanWithZero( fLogicX );
- impl_maybeReplaceNanWithZero( fLogicY );
+ double fLogicX = (*aSeriesIter)->getXValue(nIndex);
+ double fLogicY = (*aSeriesIter)->getYValue(nIndex);
if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
fLogicY = fabs( fLogicY );
@@ -762,7 +738,7 @@ void AreaChart::createShapes()
|| ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
|| ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
{
- if( m_eNanHandling == NAN_AS_GAP )
+ if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
{
drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx
index 89790912893d..ec56d9e2390b 100644
--- a/chart2/source/view/charttypes/AreaChart.hxx
+++ b/chart2/source/view/charttypes/AreaChart.hxx
@@ -104,8 +104,6 @@ private: //methods
, ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
, PlottingPositionHelper* pPosHelper );
- void impl_maybeReplaceNanWithZero( double& rfValue );
-
private: //member
PlottingPositionHelper* m_pMainPosHelper;
@@ -118,14 +116,6 @@ private: //member
sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic
::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
- enum tNanHandling
- {
- NAN_AS_ZERO,
- NAN_AS_GAP,
- NAN_AS_INTERPOLATED
- };
- tNanHandling m_eNanHandling;
-
//Properties for splines:
::com::sun::star::chart2::CurveStyle m_eCurveStyle;
sal_Int32 m_nCurveResolution;
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index baeac4a29cf1..41cef61561bb 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -45,7 +45,6 @@
#include "Clipping.hxx"
#include <com/sun/star/chart/DataLabelPlacement.hpp>
-#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <tools/debug.hxx>
@@ -653,15 +652,10 @@ void BarChart::createShapes()
getSeriesGroupShape(*aSeriesIter, xSeriesTarget) );
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getX( nCatIndex ), fSlotX );
- double fLogicBarHeight = (*aSeriesIter)->getY( nCatIndex );
+ double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nCatIndex ), fSlotX );
+ double fLogicBarHeight = (*aSeriesIter)->getYValue( nCatIndex );
if( ::rtl::math::isNan( fLogicBarHeight )) //no value at this category
- {
- if( pSeries->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO )
- fLogicBarHeight = 0.0;
- else
- continue;
- }
+ continue;
double fLogicValueForLabeDisplay = fLogicBarHeight;
fLogicBarHeight-=fBaseValue;
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
new file mode 100644
index 000000000000..b63603ef403a
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * 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: ,v $
+ * $Revision: $
+ *
+ * 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 "BubbleChart.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "ObjectIdentifier.hxx"
+#include "Splines.hxx"
+#include "LabelPositionHelper.hxx"
+#include "Clipping.hxx"
+#include "Stripe.hxx"
+
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart/DataLabelPlacement.hpp>
+#include <tools/debug.hxx>
+#include <svx/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::rtl::math;
+using namespace ::com::sun::star::chart2;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+BubbleChart::BubbleChart( const uno::Reference<XChartType>& xChartTypeModel
+ , sal_Int32 nDimensionCount )
+ : VSeriesPlotter( xChartTypeModel, nDimensionCount, false )
+ , m_bShowNegativeValues(false)
+ , m_bBubbleSizeAsArea(true)
+ , m_fBubbleSizeScaling(1.0)
+ , m_fMaxLogicBubbleSize( 0.0 )
+ , m_fBubbleSizeFactorToScreen( 1.0 )
+{
+ if( !m_pMainPosHelper )
+ m_pMainPosHelper = new PlottingPositionHelper();
+ PlotterBase::m_pPosHelper = m_pMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
+}
+
+BubbleChart::~BubbleChart()
+{
+ delete m_pMainPosHelper;
+}
+
+void BubbleChart::calculateMaximumLogicBubbleSize()
+{
+ double fMaxSize = 0.0;
+
+ sal_Int32 nStartIndex = 0;
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ for( ; aZSlotIter != aZSlotEnd; aZSlotIter++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+ for( ; aXSlotIter != aXSlotEnd; aXSlotIter++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+ for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ double fSize = pSeries->getBubble_Size( nIndex );
+ if( m_bShowNegativeValues )
+ fSize = abs(fSize);
+ if( fSize > fMaxSize )
+ fMaxSize = fSize;
+ }
+ }
+ }
+ }
+
+ m_fMaxLogicBubbleSize = fMaxSize;
+}
+
+void BubbleChart::calculateBubbleSizeScalingFactor()
+{
+ double fLogicZ=0.5;
+ drawing::Position3D aSceneMinPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMinX(),m_pMainPosHelper->getLogicMinY(),fLogicZ, false ) );
+ drawing::Position3D aSceneMaxPos( m_pMainPosHelper->transformLogicToScene( m_pMainPosHelper->getLogicMaxX(),m_pMainPosHelper->getLogicMaxY(),fLogicZ, false ) );
+
+ awt::Point aScreenMinPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMinPos ) );
+ awt::Point aScreenMaxPos( LabelPositionHelper(m_pMainPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory).transformSceneToScreenPosition( aSceneMaxPos ) );
+
+ sal_Int32 nWidth = abs( aScreenMaxPos.X - aScreenMinPos.X );
+ sal_Int32 nHeight = abs( aScreenMaxPos.Y - aScreenMinPos.Y );
+
+ sal_Int32 nMinExtend = std::min( nWidth, nHeight );
+ m_fBubbleSizeFactorToScreen = nMinExtend * 0.25;//max bubble size is 25 percent of diagram size
+}
+
+drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize )
+{
+ drawing::Direction3D aRet(0,0,0);
+
+ if( ::rtl::math::isNan(fLogicSize) || ::rtl::math::isInf(fLogicSize) )
+ return aRet;
+
+ if( m_bShowNegativeValues )
+ fLogicSize = abs(fLogicSize);
+
+ double fMaxSize = m_fMaxLogicBubbleSize;
+
+ double fMaxRadius = fMaxSize;
+ double fRaduis = fLogicSize;
+ if( m_bBubbleSizeAsArea )
+ {
+ fMaxRadius = sqrt( fMaxSize / F_PI );
+ fRaduis = sqrt( fLogicSize / F_PI );
+ }
+
+ aRet.DirectionX = m_fBubbleSizeScaling * m_fBubbleSizeFactorToScreen * fRaduis / fMaxRadius;
+ aRet.DirectionY = aRet.DirectionX;
+
+ return aRet;
+}
+
+bool BubbleChart::isExpandIfValuesCloseToBorder( sal_Int32 /*nDimensionIndex*/ )
+{
+ return true;
+}
+
+bool BubbleChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
+{
+ return false;
+}
+
+//-----------------------------------------------------------------
+
+LegendSymbolStyle BubbleChart::getLegendSymbolStyle()
+{
+ return chart2::LegendSymbolStyle_CIRCLE;
+}
+
+drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const
+{
+ return drawing::Direction3D(-1,-1,-1);
+}
+
+void BubbleChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
+{
+ VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
+}
+
+//better performance for big data
+struct FormerPoint
+{
+ FormerPoint( double fX, double fY, double fZ )
+ : m_fX(fX), m_fY(fY), m_fZ(fZ)
+ {}
+ FormerPoint()
+ {
+ ::rtl::math::setNan( &m_fX );
+ ::rtl::math::setNan( &m_fY );
+ ::rtl::math::setNan( &m_fZ );
+ }
+
+ double m_fX;
+ double m_fY;
+ double m_fZ;
+};
+
+void BubbleChart::createShapes()
+{
+ if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ return;
+
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ //therefore create an own group for the texts and the error bars to move them to front
+ //(because the text group is created after the series group the texts are displayed on top)
+ uno::Reference< drawing::XShapes > xSeriesTarget(
+ createGroupShape( m_xLogicTarget,rtl::OUString() ));
+ uno::Reference< drawing::XShapes > xTextTarget(
+ m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() ));
+
+ //update/create information for current group
+ double fLogicZ = 0.5;//as defined
+
+ sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
+ sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
+ if(nEndIndex<=0)
+ nEndIndex=1;
+
+ //better performance for big data
+ std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
+ m_bPointsWereSkipped = false;
+ sal_Int32 nSkippedPoints = 0;
+ sal_Int32 nCreatedPoints = 0;
+ //
+
+ calculateMaximumLogicBubbleSize();
+ calculateBubbleSizeScalingFactor();
+ if( m_fMaxLogicBubbleSize <= 0 || m_fBubbleSizeFactorToScreen <= 0 )
+ return;
+
+//=============================================================================
+ //iterate through all x values per indices
+ for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
+ {
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+
+ aZSlotIter = m_aZSlots.begin();
+ for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; aZSlotIter++, nZ++ )
+ {
+ ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
+ const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
+
+ aXSlotIter = aZSlotIter->begin();
+ for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; aXSlotIter++, nX++ )
+ {
+ ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
+ ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
+ const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
+
+ //=============================================================================
+ //iterate through all series
+ for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; aSeriesIter++, nSeriesIndex++ )
+ {
+ VDataSeries* pSeries( *aSeriesIter );
+ if(!pSeries)
+ continue;
+
+ uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(*aSeriesIter, xSeriesTarget);
+
+ sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
+ PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
+ if(!pPosHelper)
+ pPosHelper = m_pMainPosHelper;
+ PlotterBase::m_pPosHelper = pPosHelper;
+
+ if(m_nDimension==3)
+ fLogicZ = nZ+0.5;
+
+ //collect data point information (logic coordinates, style ):
+ double fLogicX = pSeries->getXValue(nIndex);
+ double fLogicY = pSeries->getYValue(nIndex);
+ double fBubbleSize = pSeries->getBubble_Size( nIndex );
+
+ if( !m_bShowNegativeValues && fBubbleSize<0.0 )
+ continue;
+
+ if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) )
+ continue;
+
+ if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
+ || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) )
+ continue;
+
+ bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+
+ drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
+ drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
+ pPosHelper->doLogicScaling( aScaledLogicPosition );
+
+ //transformation 3) -> 4)
+ drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+
+ //better performance for big data
+ FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
+ pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
+ if( !pSeries->isAttributedDataPoint(nIndex)
+ &&
+ pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
+ , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ {
+ nSkippedPoints++;
+ m_bPointsWereSkipped = true;
+ continue;
+ }
+ aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
+
+ //create a single datapoint if point is visible
+ if( !bIsVisible )
+ continue;
+
+ //create a group shape for this point and add to the series shape:
+ rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
+ createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
+ uno::Reference<drawing::XShape> xPointGroupShape_Shape =
+ uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
+
+ {
+ nCreatedPoints++;
+
+ //create data point
+ drawing::Direction3D aSymbolSize = transformToScreenBubbleSize( fBubbleSize );
+ if(m_nDimension!=3)
+ {
+ uno::Reference<drawing::XShape> xShape;
+ xShape = m_pShapeFactory->createCircle2D( xPointGroupShape_Shapes
+ , aScenePosition, aSymbolSize );
+
+ this->setMappedProperties( xShape
+ , pSeries->getPropertiesOfPoint( nIndex )
+ , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+
+ //create data point label
+ if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
+ {
+ LabelAlignment eAlignment = LABEL_ALIGN_TOP;
+ drawing::Position3D aScenePosition3D( aScenePosition.PositionX
+ , aScenePosition.PositionY
+ , aScenePosition.PositionZ+this->getTransformedDepth() );
+
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
+
+ switch(nLabelPlacement)
+ {
+ case ::com::sun::star::chart::DataLabelPlacement::TOP:
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
+ aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_BOTTOM;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::LEFT:
+ aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_LEFT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
+ aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
+ eAlignment = LABEL_ALIGN_RIGHT;
+ break;
+ case ::com::sun::star::chart::DataLabelPlacement::CENTER:
+ eAlignment = LABEL_ALIGN_CENTER;
+ break;
+ default:
+ DBG_ERROR("this label alignment is not implemented yet");
+ aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
+ eAlignment = LABEL_ALIGN_TOP;
+ break;
+ }
+
+
+ awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ .transformSceneToScreenPosition( aScenePosition3D ) );
+ sal_Int32 nOffset = 0;
+ if(LABEL_ALIGN_CENTER!=eAlignment)
+ nOffset = 100;//add some spacing //@todo maybe get more intelligent values
+ this->createDataLabel( xTextTarget, **aSeriesIter, nIndex
+ , fBubbleSize, fBubbleSize, aScreenPosition2D, eAlignment, nOffset );
+ }
+ }
+
+ //remove PointGroupShape if empty
+ if(!xPointGroupShape_Shapes->getCount())
+ xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
+
+ }//next series in x slot (next y slot)
+ }//next x slot
+ }//next z slot
+ }//next category
+//=============================================================================
+//=============================================================================
+//=============================================================================
+ OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/charttypes/BubbleChart.hxx b/chart2/source/view/charttypes/BubbleChart.hxx
new file mode 100644
index 000000000000..4771a4cccee3
--- /dev/null
+++ b/chart2/source/view/charttypes/BubbleChart.hxx
@@ -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: ,v $
+ * $Revision: $
+ *
+ * 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 _CHART2_BUBBLECHART_HXX
+#define _CHART2_BUBBLECHART_HXX
+
+#include "VSeriesPlotter.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class BubbleChart : public VSeriesPlotter
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ BubbleChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType >& xChartTypeModel
+ , sal_Int32 nDimensionCount );
+ virtual ~BubbleChart();
+
+ //-------------------------------------------------------------------------
+ // chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ virtual void SAL_CALL createShapes();
+
+ virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
+
+ //-------------------
+ virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
+
+ //-------------------------------------------------------------------------
+ // MinimumAndMaximumSupplier
+ //-------------------------------------------------------------------------
+ virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
+ virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
+
+ //-------------------------------------------------------------------------
+
+ virtual ::com::sun::star::chart2::LegendSymbolStyle getLegendSymbolStyle();
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //methods
+ //no default constructor
+ BubbleChart();
+
+ void calculateMaximumLogicBubbleSize();
+ void calculateBubbleSizeScalingFactor();
+
+ com::sun::star::drawing::Direction3D transformToScreenBubbleSize( double fLogicSize );
+
+private: //member
+
+ bool m_bShowNegativeValues;//input parameter
+ bool m_bBubbleSizeAsArea;//input parameter
+ double m_fBubbleSizeScaling;//input parameter
+
+ double m_fMaxLogicBubbleSize;//calculated values
+ double m_fBubbleSizeFactorToScreen;//calculated values
+};
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx
index 46fdf3d8f04d..e19a44cdcda6 100644
--- a/chart2/source/view/charttypes/CandleStickChart.cxx
+++ b/chart2/source/view/charttypes/CandleStickChart.cxx
@@ -250,7 +250,7 @@ void CandleStickChart::createShapes()
for( ; aSeriesIter != aSeriesEnd; aSeriesIter++ )
{
//collect data point information (logic coordinates, style ):
- double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getX( nIndex ), fSlotX );
+ double fLogicX = pPosHelper->getSlotPos( (*aSeriesIter)->getXValue( nIndex ), fSlotX );
double fY_First = (*aSeriesIter)->getY_First( nIndex );
double fY_Last = (*aSeriesIter)->getY_Last( nIndex );
double fY_Min = (*aSeriesIter)->getY_Min( nIndex );
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 7759f3110cbd..608adb49290b 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -376,7 +376,7 @@ void PieChart::createShapes()
sal_Int32 nPointCount=pSeries->getTotalPointCount();
for( nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++ )
{
- double fY = pSeries->getY( nPointIndex );
+ double fY = pSeries->getYValue( nPointIndex );
if(fY<0.0)
{
//@todo warn somehow that negative values are treated as positive
@@ -402,7 +402,7 @@ void PieChart::createShapes()
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries, xSeriesTarget);
//collect data point information (logic coordinates, style ):
- double fLogicYValue = fabs(pSeries->getY( nPointIndex ));
+ double fLogicYValue = fabs(pSeries->getYValue( nPointIndex ));
if( ::rtl::math::isNan(fLogicYValue) )
continue;
if(fLogicYValue==0.0)//@todo: continue also if the resolution to small
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 71f753afa5c6..73fa9039bf44 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -61,6 +61,7 @@
#include "PieChart.hxx"
#include "AreaChart.hxx"
#include "CandleStickChart.hxx"
+#include "BubbleChart.hxx"
//
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -389,7 +390,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries& rDataSeries
}
else
{
- if( m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis
+ if( rDataSeries.shouldLabelNumberFormatKeyBeDetectedFromYAxis() && m_aAxesNumberFormats.hasFormat(1,rDataSeries.getAttachedAxisIndex()) ) //y-axis
nNumberFormatKey = m_aAxesNumberFormats.getFormat(1,rDataSeries.getAttachedAxisIndex());
else
nNumberFormatKey = rDataSeries.detectNumberFormatKey( nPointIndex );
@@ -1409,7 +1410,7 @@ void VDataSeriesGroup::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaxi
sal_Int32 nPointCount = (*aSeriesIter)->getTotalPointCount();
for(sal_Int32 nN=0;nN<nPointCount;nN++)
{
- double fX = (*aSeriesIter)->getX( nN );
+ double fX = (*aSeriesIter)->getXValue( nN );
if( ::rtl::math::isNan(fX) )
continue;
if(rfMaximum<fX)
@@ -1441,12 +1442,12 @@ void VDataSeriesGroup::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY,
if( nAxisIndex != (*aSeriesIter)->getAttachedAxisIndex() )
continue;
- double fX = (*aSeriesIter)->getX( nN );
+ double fX = (*aSeriesIter)->getXValue( nN );
if( ::rtl::math::isNan(fX) )
continue;
if( fX < fMinX || fX > fMaxX )
continue;
- double fY = (*aSeriesIter)->getY( nN );
+ double fY = (*aSeriesIter)->getYValue( nN );
if( ::rtl::math::isNan(fY) )
continue;
if(rfMaxY<fY)
@@ -2063,6 +2064,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter(
pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true);
+ else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) )
+ pRet = new BubbleChart(xChartTypeModel,nDimensionCount);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
pRet = new PieChart(xChartTypeModel,nDimensionCount);
else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) )
diff --git a/chart2/source/view/charttypes/makefile.mk b/chart2/source/view/charttypes/makefile.mk
index 434db9304788..1da5697fd25f 100644
--- a/chart2/source/view/charttypes/makefile.mk
+++ b/chart2/source/view/charttypes/makefile.mk
@@ -51,7 +51,8 @@ SLOFILES = $(SLO)$/Splines.obj \
$(SLO)$/BarChart.obj \
$(SLO)$/PieChart.obj \
$(SLO)$/AreaChart.obj \
- $(SLO)$/CandleStickChart.obj
+ $(SLO)$/CandleStickChart.obj \
+ $(SLO)$/BubbleChart.obj
# --- Targets -----------------------------------------------------------------
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 63a7c7558a5b..7e7e564ab3b8 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -159,6 +159,11 @@ public:
, const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize );
+
//------------------- create 2D elements:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
diff --git a/chart2/source/view/inc/VDataSeries.hxx b/chart2/source/view/inc/VDataSeries.hxx
index 61c0a15bc402..9426c1e9256c 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -89,14 +89,16 @@ public:
void setPageReferenceSize( const ::com::sun::star::awt::Size & rPageRefSize );
sal_Int32 getTotalPointCount() const;
- double getX( sal_Int32 index ) const;
- double getY( sal_Int32 index ) const;
+ double getXValue( sal_Int32 index ) const;
+ double getYValue( sal_Int32 index ) const;
double getY_Min( sal_Int32 index ) const;
double getY_Max( sal_Int32 index ) const;
double getY_First( sal_Int32 index ) const;
double getY_Last( sal_Int32 index ) const;
+ double getBubble_Size( sal_Int32 index ) const;
+
double getMinimumofAllDifferentYValues( sal_Int32 index ) const;
double getMaximumofAllDifferentYValues( sal_Int32 index ) const;
@@ -108,6 +110,7 @@ public:
bool hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
sal_Int32 getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const;
sal_Int32 detectNumberFormatKey( sal_Int32 nPointIndex ) const;
+ bool shouldLabelNumberFormatKeyBeDetectedFromYAxis() const;
sal_Int32 getLabelPlacement( sal_Int32 nPointIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType
, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const;
@@ -141,6 +144,8 @@ public:
void setStartingAngle( sal_Int32 nStartingAngle );
sal_Int32 getStartingAngle() const;
+ void setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole );
+
//this is only temporarily here for area chart:
::com::sun::star::drawing::PolyPolygonShape3D m_aPolyPolygonShape3D;
sal_Int32 m_nPolygonIndex;
@@ -207,6 +212,10 @@ private: //member
VDataSequence m_aValues_Y_First;
VDataSequence m_aValues_Y_Last;
+ VDataSequence m_aValues_Bubble_Size;
+
+ VDataSequence* m_pValueSequenceForDataLabelNumberFormatDetection;
+
mutable double m_fYMeanValue;
::com::sun::star::uno::Sequence< sal_Int32 > m_aAttributedDataPointIndexList;
@@ -248,7 +257,8 @@ private: //member
::com::sun::star::awt::Size m_aReferenceSize;
//
- sal_Int32 m_nMissingValueTreatment;
+ sal_Int32 m_nMissingValueTreatment;
+ bool m_bAllowPercentValueInDataLabel;
};
//.............................................................................
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 63c5656a83e0..f3024a10e958 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -66,6 +66,7 @@ ChartItemPool::ChartItemPool():
ppPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0);
SvULongs aTmp;
ppPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,aTmp);
+ ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE);
ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT, SCHATTR_LEGEND_POS );
// ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index fd08defe1869..7098e150a175 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -86,7 +86,6 @@
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
@@ -725,6 +724,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
rtl::OUString aSeriesParticle( ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCS, nT, nS ) );
pSeries->setParticle(aSeriesParticle);
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+ pSeries->setRoleOfSequenceForDataLabelNumberFormatDetection(aRole);
+
//ignore secondary axis for charttypes that do not suppoert them
if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
!ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 ) )
@@ -1742,7 +1744,7 @@ sal_Int32 lcl_getExplicitNumberFormatKeyForAxis(
for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
{
if( nDimensionIndex != 0 )
- aRoleToMatch = aChartTypes[nCTIdx]->getRoleOfSequenceForSeriesLabel();
+ aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
@@ -1855,24 +1857,36 @@ sal_Int32 ExplicitValueProvider::getPercentNumberFormat( const Reference< util::
}
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForLabel(
+sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
const uno::Reference< XDataSeries >& xSeries,
sal_Int32 nPointIndex /*-1 for whole series*/,
- const uno::Reference< beans::XPropertySet >& xAttachedAxisProps
+ const uno::Reference< XDiagram >& xDiagram
)
{
sal_Int32 nFormat=0;
if( !xSeriesOrPointProp.is() )
return nFormat;
+
rtl::OUString aPropName( C2U( "NumberFormat" ) );
if( !(xSeriesOrPointProp->getPropertyValue(aPropName) >>= nFormat) )
{
- if( xAttachedAxisProps.is() && !( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
+ uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) );
+
+ bool bFormatFound = false;
+ if( ChartTypeHelper::shouldLabelNumberFormatKeyBeDetectedFromYAxis( xChartType ) )
+ {
+ uno::Reference< beans::XPropertySet > xAttachedAxisProps( DiagramHelper::getAttachedAxis( xSeries, xDiagram ), uno::UNO_QUERY );
+ if( xAttachedAxisProps.is() && ( xAttachedAxisProps->getPropertyValue( aPropName ) >>= nFormat ) )
+ bFormatFound = true;
+ }
+ if( !bFormatFound )
{
Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY );
+ OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) );
+
Reference< data::XLabeledDataSequence > xLabeledSequence(
- DataSeriesHelper::getDataSequenceByRole( xSeriesSource, C2U("values-y"), false ));
+ DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole, false ));
if( xLabeledSequence.is() )
{
Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() );
@@ -1886,7 +1900,7 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForLabel(
return nFormat;
}
-sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForLabel(
+sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp,
const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
{
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 21bf943c9899..2e286499ccc3 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -1573,6 +1573,53 @@ uno::Reference< drawing::XShapes >
}
uno::Reference< drawing::XShape >
+ ShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
+ , const drawing::Position3D& rPosition
+ , const drawing::Direction3D& rSize )
+{
+ if( !xTarget.is() )
+ return 0;
+
+ //create shape
+ uno::Reference< drawing::XShape > xShape(
+ m_xShapeFactory->createInstance( C2U(
+ "com.sun.star.drawing.EllipseShape") ), uno::UNO_QUERY );
+ xTarget->add(xShape);
+
+ try
+ {
+ drawing::Position3D aCenterPosition(
+ rPosition.PositionX - (rSize.DirectionX / 2.0),
+ rPosition.PositionY - (rSize.DirectionY / 2.0),
+ rPosition.PositionZ );
+ xShape->setPosition( Position3DToAWTPoint( aCenterPosition ));
+ xShape->setSize( Direction3DToAWTSize( rSize ));
+ }
+ catch( const uno::Exception & e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ //set properties
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ DBG_ASSERT(xProp.is(), "created shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ drawing::CircleKind eKind = drawing::CircleKind_FULL;
+ xProp->setPropertyValue( C2U( UNO_NAME_CIRCKIND )
+ , uno::makeAny( eKind ) );
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+ return xShape;
+}
+
+uno::Reference< drawing::XShape >
ShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
, const drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties )
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index f3e8f4a19739..76ba65e2e97d 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -140,6 +140,13 @@ void lcl_clearIfTextIsContained( VDataSequence& rData, const uno::Reference<data
}
}
+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) )
+ rfValue = 0.0;
+}
+
}
VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
@@ -163,6 +170,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, m_aValues_Y_Max()
, m_aValues_Y_First()
, m_aValues_Y_Last()
+ , m_aValues_Bubble_Size()
+ , m_pValueSequenceForDataLabelNumberFormatDetection(&m_aValues_Y)
, m_fYMeanValue(1.0)
@@ -193,6 +202,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
, m_apSymbolProperties_InvisibleSymbolForSelection(NULL)
, m_nCurrentAttributedPoint(-1)
, m_nMissingValueTreatment(::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
+ , m_bAllowPercentValueInDataLabel(false)
{
::rtl::math::setNan( & m_fYMeanValue );
@@ -230,7 +240,8 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
m_aValues_Y_First.init( xDataSequence );
else if( aRole.equals(C2U("values-last")) )
m_aValues_Y_Last.init( xDataSequence );
- //@todo assign the other roles (+ error for unknown?)
+ else if( aRole.equals(C2U("values-size")) )
+ m_aValues_Bubble_Size.init( xDataSequence );
}
catch( uno::Exception& e )
{
@@ -242,13 +253,15 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
//determine the point count
m_nPointCount = m_aValues_Y.getLength();
{
+ if( m_nPointCount < m_aValues_Bubble_Size.getLength() )
+ m_nPointCount = m_aValues_Bubble_Size.getLength();
if( m_nPointCount < m_aValues_Y_Min.getLength() )
m_nPointCount = m_aValues_Y_Min.getLength();
- if( m_nPointCount < m_aValues_Y_Max.getLength() )
+ if( m_nPointCount < m_aValues_Y_Max.getLength() )
m_nPointCount = m_aValues_Y_Max.getLength();
- if( m_nPointCount < m_aValues_Y_First.getLength() )
+ if( m_nPointCount < m_aValues_Y_First.getLength() )
m_nPointCount = m_aValues_Y_First.getLength();
- if( m_nPointCount < m_aValues_Y_Last.getLength() )
+ if( m_nPointCount < m_aValues_Y_Last.getLength() )
m_nPointCount = m_aValues_Y_Last.getLength();
}
@@ -331,6 +344,7 @@ void VDataSeries::releaseShapes()
void VDataSeries::setCategoryXAxis()
{
m_aValues_X.clear();
+ m_bAllowPercentValueInDataLabel = true;
}
void VDataSeries::setGlobalSeriesIndex( sal_Int32 nGlobalSeriesIndex )
@@ -445,27 +459,48 @@ sal_Int32 VDataSeries::getTotalPointCount() const
return m_nPointCount;
}
-double VDataSeries::getX( sal_Int32 index ) const
+double VDataSeries::getXValue( sal_Int32 index ) const
{
+ double fRet = 0.0;
if(m_aValues_X.is())
{
if( 0<=index && index<m_aValues_X.getLength() )
- return m_aValues_X.Doubles[index];
+ fRet = m_aValues_X.Doubles[index];
+ else
+ ::rtl::math::setNan( &fRet );
}
else
{
// #i70133# always return correct X position - needed for short data series
if( 0<=index /*&& index < m_nPointCount*/ )
- return index+1;//first category (index 0) matches with real number 1.0
+ fRet = index+1;//first category (index 0) matches with real number 1.0
+ else
+ ::rtl::math::setNan( &fRet );
}
- double fNan;
- ::rtl::math::setNan( & fNan );
- return fNan;
+ lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
+ return fRet;
}
-double VDataSeries::getY( sal_Int32 index ) const
+double VDataSeries::getYValue( sal_Int32 index ) const
{
- return m_aValues_Y.getValue( index );
+ double fRet = 0.0;
+ if(m_aValues_Y.is())
+ {
+ if( 0<=index && index<m_aValues_Y.getLength() )
+ fRet = m_aValues_Y.Doubles[index];
+ else
+ ::rtl::math::setNan( &fRet );
+ }
+ else
+ {
+ // #i70133# always return correct X position - needed for short data series
+ if( 0<=index /*&& index < m_nPointCount*/ )
+ fRet = index+1;//first category (index 0) matches with real number 1.0
+ else
+ ::rtl::math::setNan( &fRet );
+ }
+ lcl_maybeReplaceNanWithZero( fRet, getMissingValueTreatment() );
+ return fRet;
}
double VDataSeries::getY_Min( sal_Int32 index ) const
@@ -484,6 +519,10 @@ double VDataSeries::getY_Last( sal_Int32 index ) const
{
return m_aValues_Y_Last.getValue( index );
}
+double VDataSeries::getBubble_Size( sal_Int32 index ) const
+{
+ return m_aValues_Bubble_Size.getValue( index );
+}
bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const
{
@@ -504,9 +543,37 @@ sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bFor
xPointProp->getPropertyValue(aPropName) >>= nNumberFormat;
return nNumberFormat;
}
+void VDataSeries::setRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::OUString& rRole )
+{
+ if( rRole.equals(C2U("values-y")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y;
+ else if( rRole.equals(C2U("values-size")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Bubble_Size;
+ else if( rRole.equals(C2U("values-min")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Min;
+ else if( rRole.equals(C2U("values-max")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Max;
+ else if( rRole.equals(C2U("values-first")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_First;
+ else if( rRole.equals(C2U("values-last")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_Y_Last;
+ else if( rRole.equals(C2U("values-x")) )
+ m_pValueSequenceForDataLabelNumberFormatDetection = &m_aValues_X;
+}
+bool VDataSeries::shouldLabelNumberFormatKeyBeDetectedFromYAxis() const
+{
+ if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_Bubble_Size )
+ return false;
+ else if( m_pValueSequenceForDataLabelNumberFormatDetection == &m_aValues_X )
+ return false;
+ return true;
+}
sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const
{
- return m_aValues_Y.detectNumberFormatKey( index );
+ sal_Int32 nRet = 0;
+ if( m_pValueSequenceForDataLabelNumberFormatDetection )
+ nRet = m_pValueSequenceForDataLabelNumberFormatDetection->detectNumberFormatKey( index );
+ return nRet;
}
sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY ) const
@@ -545,7 +612,7 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe
double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getY( index );
+ double fY = getYValue( index );
double fY_Min = getY_Min( index );
double fY_Max = getY_Max( index );
double fY_First = getY_First( index );
@@ -572,7 +639,7 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const
double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const
{
- double fY = getY( index );
+ double fY = getYValue( index );
double fY_Min = getY_Min( index );
double fY_Max = getY_Max( index );
double fY_First = getY_First( index );
@@ -612,6 +679,14 @@ uno::Sequence< double > VDataSeries::getAllX() const
uno::Sequence< double > VDataSeries::getAllY() const
{
+ if(!m_aValues_Y.is() && !m_aValues_Y.getLength() && m_nPointCount)
+ {
+ //init y values from indexes
+ //first y-value (index 0) matches with real number 1.0
+ m_aValues_Y.Doubles.realloc( m_nPointCount );
+ for(sal_Int32 nN=m_aValues_Y.getLength();nN--;)
+ m_aValues_Y.Doubles[nN] = nN+1;
+ }
return m_aValues_Y.Doubles;
}
@@ -806,6 +881,11 @@ DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const
m_apLabel_Series = getDataPointLabelFromPropertySet( this->getPropertiesOfPoint( index ) );
pRet = m_apLabel_Series.get();
}
+ if( !m_bAllowPercentValueInDataLabel )
+ {
+ if( pRet )
+ pRet->ShowNumberInPercent = false;
+ }
return pRet;
}
diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx
index 60479659e957..ea52e000c552 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -1713,7 +1713,7 @@ bool XclExpChSeries::ConvertDataSeries(
Reference< XDataSource > xDataSource( xDataSeries, UNO_QUERY );
if( xDataSource.is() )
{
- Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq;
+ Reference< XDataSequence > xYValueSeq, xTitleSeq, xXValueSeq, xBubbleSeq;
// find first sequence with role 'values-y'
Sequence< Reference< XLabeledDataSequence > > aLabeledSeqVec = xDataSource->getDataSequences();
@@ -1729,12 +1729,18 @@ bool XclExpChSeries::ConvertDataSeries(
if( !xYValueSeq.is() && (aRole == EXC_CHPROP_ROLE_YVALUES) )
{
xYValueSeq = xTmpValueSeq;
- xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
+ if( !xTitleSeq.is() )
+ xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
}
else if( !xXValueSeq.is() && !rTypeInfo.mbCategoryAxis && (aRole == EXC_CHPROP_ROLE_XVALUES) )
{
xXValueSeq = xTmpValueSeq;
}
+ else if( !xBubbleSeq.is() && (rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES) && (aRole == EXC_CHPROP_ROLE_SIZEVALUES) )
+ {
+ xBubbleSeq = xTmpValueSeq;
+ xTitleSeq = (*pIt)->getLabel(); // ignore role of label sequence
+ }
}
}
@@ -1751,6 +1757,10 @@ bool XclExpChSeries::ConvertDataSeries(
// X values of XY charts
maData.mnCategCount = mxCategLink->ConvertDataSequence( xXValueSeq, false, maData.mnValueCount );
+ // size values of bubble charts
+ if( mxBubbleLink.is() )
+ mxBubbleLink->ConvertDataSequence( xBubbleSeq, false, maData.mnValueCount );
+
// series formatting
XclChDataPointPos aPointPos( mnSeriesIdx );
ScfPropertySet aSeriesProp( xDataSeries );
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index d74071f17cab..c0a0610cc2a3 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1782,6 +1782,14 @@ Reference< XDataSeries > XclImpChSeries::CreateDataSeries() const
CreateCategSequence( EXC_CHPROP_ROLE_XVALUES );
if( xXValueSeq.is() )
aLabeledSeqVec.push_back( xXValueSeq );
+ // add size values of bubble charts
+ if( rTypeInfo.meTypeId == EXC_CHTYPEID_BUBBLES )
+ {
+ Reference< XLabeledDataSequence > xSizeValueSeq =
+ lclCreateLabeledDataSequence( mxBubbleLink, EXC_CHPROP_ROLE_SIZEVALUES, mxTitleLink.get() );
+ if( xSizeValueSeq.is() )
+ aLabeledSeqVec.push_back( xSizeValueSeq );
+ }
}
// attach labeled data sequences to series
if( !aLabeledSeqVec.empty() )
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index af8cbfdf229f..dfe74405fbf6 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -511,6 +511,7 @@ const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType";
const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType";
const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType";
const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType";
+const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType";
const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
namespace csscd = ::com::sun::star::chart::DataLabelPlacement;
@@ -529,7 +530,7 @@ static const XclChTypeInfo spTypeInfos[] =
{ EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false },
{ EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false },
{ EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false },
- { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
+ { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
{ EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false },
{ EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }
};
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index e8fab52ca819..182cd86e4a9d 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -664,6 +664,7 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
sal_Int16 nApiEscapement = 0;
sal_Int8 nApiEscHeight = 0;
maHlpChEscapement.ReadFromPropertySet( rPropSet );
+ maHlpChEscapement.ReadFromPropertySet( rPropSet );
maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
rFontData.SetApiEscapement( nApiEscapement );
}
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index 77e85eda32b9..7e3873b1f1cf 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -156,6 +156,7 @@ namespace com { namespace sun { namespace star {
#define EXC_CHPROP_ROLE_CLOSEVALUES CREATE_OUSTRING( "values-last" )
#define EXC_CHPROP_ROLE_LOWVALUES CREATE_OUSTRING( "values-min" )
#define EXC_CHPROP_ROLE_HIGHVALUES CREATE_OUSTRING( "values-max" )
+#define EXC_CHPROP_ROLE_SIZEVALUES CREATE_OUSTRING( "values-size" )
// Constants and Enumerations =================================================