diff options
Diffstat (limited to 'chart2/source/controller')
25 files changed, 256 insertions, 43 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, |