diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2009-09-10 09:31:32 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2009-09-10 09:31:32 -0400 |
commit | f3236d872b33bdd5d67a30a229b764ea8e89c7a0 (patch) | |
tree | 36faee386ae6b78043ea86caa4d6b2025717fb25 /chart2/source | |
parent | c76bcee2c05a4ba0d58c034e48da812f3bc6c416 (diff) | |
parent | bce8c1c3ae219d2b2a6c76e0599c33eec90d8d57 (diff) |
rebased to DEV300_m57.
Diffstat (limited to 'chart2/source')
43 files changed, 562 insertions, 135 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index fcc17fefeebc..397527f3ea9d 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -95,6 +95,7 @@ enum eServiceType SERVICE_NAME_DONUT_DIAGRAM, SERVICE_NAME_LINE_DIAGRAM, SERVICE_NAME_NET_DIAGRAM, + SERVICE_NAME_FILLED_NET_DIAGRAM, SERVICE_NAME_PIE_DIAGRAM, SERVICE_NAME_STOCK_DIAGRAM, SERVICE_NAME_XY_DIAGRAM, @@ -124,6 +125,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap() ( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM ) ( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM ) ( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM ) + ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM ) ( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM ) ( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM ) ( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM ) @@ -1341,6 +1343,14 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( bCreateDiagram = true; } break; + case SERVICE_NAME_FILLED_NET_DIAGRAM: + if( xManagerFact.is()) + { + xTemplate.set( + xManagerFact->createInstance( + C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY ); + bCreateDiagram = true; + } case SERVICE_NAME_PIE_DIAGRAM: if( xManagerFact.is()) { diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index fe1359aab7f3..4a02d9aa99e5 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -538,6 +538,10 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) if( aName.indexOf( C2U("Scatter") ) != -1 ) return C2U( "com.sun.star.chart.XYDiagram" ); + // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet" + if( aName.indexOf( C2U("FilledNet") ) != -1 ) + return C2U( "com.sun.star.chart.FilledNetDiagram" ); + // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol" // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol" // "PercentStackedNetLine" @@ -591,6 +595,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap() ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" ) , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) ) + ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" ) + , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) ) + ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" ) , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) ) diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc index 07ed2eeec0d5..8823b582a28e 100644 --- a/chart2/source/controller/dialogs/Bitmaps.hrc +++ b/chart2/source/controller/dialogs/Bitmaps.hrc @@ -173,8 +173,8 @@ #define BMP_NET_SYMB_STACK (RID_APP_START + 77) #define BMP_NET_LINESYMB (RID_APP_START + 78) #define BMP_NET_LINESYMB_STACK (RID_APP_START + 79) -#define BMP_NET_FILLED (RID_APP_START + 80) -#define BMP_NET_FILLED_STACKED (RID_APP_START + 81) +#define BMP_NET_FILL (RID_APP_START + 80) +#define BMP_NET_FILL_STACK (RID_APP_START + 81) //---------------------- // Stock Chart Subtypes diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src index 35a897848fb1..67d8588897d8 100644 --- a/chart2/source/controller/dialogs/Bitmaps.src +++ b/chart2/source/controller/dialogs/Bitmaps.src @@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK { File = "netlinepointstack_52x60.png" ; }; -Bitmap BMP_NET_FILLED +Bitmap BMP_NET_FILL { - File = "net_52x60.png" ; + File = "netfill_52x60.png" ; }; -Bitmap BMP_NET_FILLED_STACKED +Bitmap BMP_NET_FILL_STACK { - File = "netstack_52x60.png" ; + File = "netstackfill_52x60.png" ; }; //--------------------- Bitmap BMP_PYRAMIDQ_3D_1 diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc index 84a23ba426bc..8dd4acaffd15 100644 --- a/chart2/source/controller/dialogs/Bitmaps_HC.hrc +++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc @@ -173,8 +173,8 @@ #define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77) #define BMP_NET_LINESYMB_HC (RID_SCH_START + 78) #define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79) -#define BMP_NET_FILLED_HC (RID_SCH_START + 80) -#define BMP_NET_FILLED_STACKED_HC (RID_SCH_START + 81) +#define BMP_NET_FILL_HC (RID_SCH_START + 80) +#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81) //---------------------- // Stock Chart Subtypes diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src index 0fb7ef5e5a1a..a82893273ae2 100644 --- a/chart2/source/controller/dialogs/Bitmaps_HC.src +++ b/chart2/source/controller/dialogs/Bitmaps_HC.src @@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK_HC { File = "netlinepointstack_52x60_h.png" ; }; -Bitmap BMP_NET_FILLED_HC +Bitmap BMP_NET_FILL_HC { - File = "net_52x60_h.png" ; + File = "netfill_52x60_h.png" ; }; -Bitmap BMP_NET_FILLED_STACKED_HC +Bitmap BMP_NET_FILL_STACK_HC { - File = "netstack_52x60_h.png" ; + File = "netstackfill_52x60_h.png" ; }; //--------------------- Bitmap BMP_PYRAMIDQ_3D_1_HC diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index de57e82e58da..fa51d17a03d8 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -1000,6 +1000,10 @@ const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTempla ( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) ) ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) ) + + ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) ) + ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) ) + ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) ) ; return m_aTemplateMap; } @@ -1012,17 +1016,20 @@ void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIs rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) ); rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) ); rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) ); + rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) ); } else { rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) ); rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) ); rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) ); + rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) ); } rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) ); rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) ); rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) ); + rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) ); } void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) { @@ -1040,6 +1047,10 @@ void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rPa rParameter.bSymbols = false; rParameter.bLines = true; break; + case 4: + rParameter.bSymbols = false; + rParameter.bLines = false; + break; default: rParameter.bSymbols = true; rParameter.bLines = false; diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 0a9b58758de6..56ef98b159ba 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -413,7 +413,8 @@ Image SeriesHeader::GetChartTypeImage( { aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC ); } - else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )) + else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET ) + || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) ) { aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC ); } diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src index 2234f04a3fcd..f2731b2971c2 100644 --- a/chart2/source/controller/dialogs/Strings_ChartTypes.src +++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src @@ -139,6 +139,10 @@ String STR_DEEP { Text [ en-US ] = "Deep" ; }; +String STR_FILLED +{ + Text [ en-US ] = "Filled" ; +}; //----------------------------------------------------------------------------- String STR_TYPE_BUBBLE { diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 1d76a106d72b..1aa7db1f0f17 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -202,6 +202,19 @@ DataSourceDialog::~DataSourceDialog() delete m_pTabControl; } +short DataSourceDialog::Execute() +{ + short nResult = TabDialog::Execute(); + if( nResult == RET_OK ) + { + if( m_pRangeChooserTabePage ) + m_pRangeChooserTabePage->commitPage(); + if( m_pDataSourceTabPage ) + m_pDataSourceTabPage->commitPage(); + } + return nResult; +} + void DataSourceDialog::setInvalidPage( TabPage * pTabPage ) { if( pTabPage == m_pRangeChooserTabePage ) diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index b2d64400ef98..c35f11546d36 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -995,7 +995,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG ) aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel ); this->fillAllControls( aParameter ); - m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel); + uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY ); + m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps); } return 0; } diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index f499e2acc23a..ff858c5bfdf5 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -377,6 +377,29 @@ void DataSourceTabPage::initializePage() { } +void DataSourceTabPage::DeactivatePage() +{ + commitPage(); + svt::OWizardPage::DeactivatePage(); +} + +void DataSourceTabPage::commitPage() +{ + commitPage(eFinish); +} + +sal_Bool DataSourceTabPage::commitPage( CommitPageReason /*eReason*/ ) +{ + //ranges may have been edited in the meanwhile (dirty is true in that case here) + if( isValid() ) + { + updateModelFromControl( 0 /*update all*/ ); + return sal_True;//return false if this page should not be left + } + else + return sal_False; +} + bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit ) { OUString aRange( rEdit.GetText()); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index 2703836d5d1d..6c42f1cb98e2 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -87,8 +87,15 @@ public: bool bHideDescription = false ); virtual ~DataSourceTabPage(); + void commitPage(); + +protected: // OWizardPage virtual void ActivatePage(); + virtual sal_Bool commitPage( CommitPageReason eReason ); + + //TabPage + virtual void DeactivatePage(); virtual void initializePage(); diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index 2c2bc3fc6892..8ba4d61a8057 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -216,6 +216,29 @@ void RangeChooserTabPage::initControlsFromModel() m_nChangingControlCalls--; } +void RangeChooserTabPage::DeactivatePage() +{ + commitPage(); + svt::OWizardPage::DeactivatePage(); +} + +void RangeChooserTabPage::commitPage() +{ + commitPage(eFinish); +} + +sal_Bool RangeChooserTabPage::commitPage( CommitPageReason /*eReason*/ ) +{ + //ranges may have been edited in the meanwhile (dirty is true in that case here) + if( isValid() ) + { + changeDialogModelAccordingToControls(); + return sal_True;//return false if this page should not be left + } + else + return sal_False; +} + void RangeChooserTabPage::changeDialogModelAccordingToControls() { if(m_nChangingControlCalls>0) diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx index 01062ba4c0f1..bb508da8d9a1 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx @@ -70,10 +70,16 @@ virtual ~RangeChooserTabPage(); virtual void listeningFinished( const ::rtl::OUString & rNewRange ); virtual void disposingRangeSelection(); + void commitPage(); + protected: //methods //OWizardPage virtual void ActivatePage(); + virtual sal_Bool commitPage( CommitPageReason eReason ); + + //TabPage + virtual void DeactivatePage(); void initControlsFromModel(); void changeDialogModelAccordingToControls(); diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index cfbe7aa561e8..331136607e75 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -68,6 +68,9 @@ public: ::com::sun::star::uno::XComponentContext > & xContext ); virtual ~DataSourceDialog(); + // from Dialog (base of TabDialog) + virtual short Execute(); + // TabPageNotifiable virtual void setInvalidPage( TabPage * pTabPage ); virtual void setValidPage( TabPage * pTabPage ); diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk index d2d399d22cff..45060a60d297 100644 --- a/chart2/source/controller/makefile.mk +++ b/chart2/source/controller/makefile.mk @@ -90,6 +90,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ $(SALLIB) \ $(SVLLIB) \ $(SVTOOLLIB) \ + $(SVXCORELIB) \ $(SVXLIB) \ $(TKLIB) \ $(TOOLSLIB) \ diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index df43e24a9482..9c5cdafe49f2 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -83,6 +83,8 @@ public: static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries ); SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static sal_Int32 //one of ::com::sun::star::chart2::AxisType getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType , sal_Int32 nDimensionIndex ); diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx index 102ffde71918..493c4d2096e2 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -121,6 +121,10 @@ OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly( , sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 ); //----------------------------------------------------------------------------- +OOO_DLLPUBLIC_CHARTTOOLS +void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet + , const com::sun::star::drawing::PolyPolygonShape3D& rAdd ); +//----------------------------------------------------------------------------- /** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D */ OOO_DLLPUBLIC_CHARTTOOLS diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index 133f5bcc255b..1092efe6e900 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -33,7 +33,7 @@ // this includes no link dependency #include <svtools/solar.hrc> -//next free is 285 +//next free is 286 //single free is: 134 //#define RID_APP_START 30000 @@ -100,6 +100,7 @@ #define STR_STACKED (RID_APP_START + 11) #define STR_PERCENT (RID_APP_START + 12) #define STR_DEEP (RID_APP_START + 13) +#define STR_FILLED (RID_APP_START + 285) #define STR_DONUT (RID_APP_START + 8) #define STR_TYPE_PIE (RID_APP_START + 187) diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx index 1c2782de3852..1e824798fa66 100644 --- a/chart2/source/inc/servicenames_charttypes.hxx +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -42,6 +42,7 @@ namespace chart #define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType") diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index 0e4a3a119a02..bb419a10f1ac 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -128,6 +128,9 @@ enum TemplateId TEMPLATE_PERCENTSTACKEDNET, TEMPLATE_PERCENTSTACKEDNETSYMBOL, TEMPLATE_PERCENTSTACKEDNETLINE, + TEMPLATE_FILLEDNET, + TEMPLATE_STACKEDFILLEDNET, + TEMPLATE_PERCENTSTACKEDFILLEDNET, TEMPLATE_STOCKLOWHIGHCLOSE, TEMPLATE_STOCKOPENLOWHIGHCLOSE, TEMPLATE_STOCKVOLUMELOWHIGHCLOSE, @@ -200,6 +203,9 @@ const tTemplateMapType & lcl_DefaultChartTypeMap() ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE ) + ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET ) + ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET ) + ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET ) ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE ) ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE ) ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE ) @@ -503,6 +509,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance( StackMode_Y_STACKED_PERCENT, false, true )); break; + case TEMPLATE_FILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_NONE, false, false, true )); + break; + case TEMPLATE_STACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_Y_STACKED, false, false, true )); + break; + case TEMPLATE_PERCENTSTACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_Y_STACKED_PERCENT, false, false, true )); + break; case TEMPLATE_STOCKLOWHIGHCLOSE: xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, diff --git a/chart2/source/model/template/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx new file mode 100644 index 000000000000..ce96488270a4 --- /dev/null +++ b/chart2/source/model/template/FilledNetChartType.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FilledNetChartType.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" +#include "FilledNetChartType.hxx" +#include "PropertyHelper.hxx" +#include "macros.hxx" +#include "PolarCoordinateSystem.hxx" +#include "Scaling.hxx" +#include "servicenames_charttypes.hxx" +#include "ContainerHelper.hxx" +#include "AxisIndexDefines.hxx" +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/chart2/AxisType.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::chart2; + +using ::rtl::OUString; +using ::com::sun::star::beans::Property; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::osl::MutexGuard; + +namespace chart +{ + +FilledNetChartType::FilledNetChartType( + const uno::Reference< uno::XComponentContext > & xContext ) : + NetChartType_Base( xContext ) +{} + +FilledNetChartType::FilledNetChartType( const FilledNetChartType & rOther ) : + NetChartType_Base( rOther ) +{ +} + +FilledNetChartType::~FilledNetChartType() +{} + +// ____ XCloneable ____ +uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone() + throw (uno::RuntimeException) +{ + return uno::Reference< util::XCloneable >( new FilledNetChartType( *this )); +} + +// ____ XChartType ____ +::rtl::OUString SAL_CALL FilledNetChartType::getChartType() + throw (uno::RuntimeException) +{ + return CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET; +} + +uno::Sequence< ::rtl::OUString > FilledNetChartType::getSupportedServiceNames_Static() +{ + uno::Sequence< ::rtl::OUString > aServices( 3 ); + aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET; + aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" ); + aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" ); + return aServices; +} + +// implement XServiceInfo methods basing upon getSupportedServiceNames_Static +APPHELPER_XSERVICEINFO_IMPL( FilledNetChartType, + C2U( "com.sun.star.comp.chart.FilledNetChartType" )); + +} // namespace chart diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx new file mode 100644 index 000000000000..3e694c12b0dd --- /dev/null +++ b/chart2/source/model/template/FilledNetChartType.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FilledNetChartType.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CHART_FILLEDNETCHARTTYPE_HXX +#define CHART_FILLEDNETCHARTTYPE_HXX + +#include "NetChartType.hxx" +#include "ServiceMacros.hxx" + +namespace chart +{ + +class FilledNetChartType : public NetChartType_Base +{ +public: + FilledNetChartType( ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + virtual ~FilledNetChartType(); + + APPHELPER_XSERVICEINFO_DECL() + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( FilledNetChartType ) + +protected: + explicit FilledNetChartType( const FilledNetChartType & rOther ); + + // ____ XChartType ____ + virtual ::rtl::OUString SAL_CALL getChartType() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); +}; + +} // namespace chart + +// CHART_FILLEDNETCHARTTYPE_HXX +#endif diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx index 9de315679223..757d2dc07122 100644 --- a/chart2/source/model/template/NetChartType.cxx +++ b/chart2/source/model/template/NetChartType.cxx @@ -52,76 +52,24 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::osl::MutexGuard; -namespace -{ - -void lcl_AddPropertiesToVector( - ::std::vector< Property > & /* rOutProperties */ ) -{ -} - -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & /* rOutMap */ ) -{ -} - -const Sequence< Property > & lcl_GetPropertySequence() -{ - static Sequence< Property > aPropSeq; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) - { - // get properties - ::std::vector< ::com::sun::star::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - // and sort them for access via bsearch - ::std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); - } - - return aPropSeq; -} - -} // anonymous namespace - namespace chart { -NetChartType::NetChartType( +NetChartType_Base::NetChartType_Base( const uno::Reference< uno::XComponentContext > & xContext ) : ChartType( xContext ) {} -NetChartType::NetChartType( const NetChartType & rOther ) : +NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) : ChartType( rOther ) { } -NetChartType::~NetChartType() +NetChartType_Base::~NetChartType_Base() {} -// ____ XCloneable ____ -uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone() - throw (uno::RuntimeException) -{ - return uno::Reference< util::XCloneable >( new NetChartType( *this )); -} - -// ____ XChartType ____ -::rtl::OUString SAL_CALL NetChartType::getChartType() - throw (uno::RuntimeException) -{ - return CHART2_SERVICE_NAME_CHARTTYPE_NET; -} - Reference< XCoordinateSystem > SAL_CALL - NetChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) + NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount ) throw (lang::IllegalArgumentException, uno::RuntimeException) { @@ -157,42 +105,23 @@ Reference< XCoordinateSystem > SAL_CALL } // ____ OPropertySet ____ -uno::Any NetChartType::GetDefaultValue( sal_Int32 nHandle ) const +uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const throw(beans::UnknownPropertyException) { - static tPropertyValueMap aStaticDefaults; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - // initialize defaults - lcl_AddDefaultsToMap( aStaticDefaults ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) - return uno::Any(); - - return (*aFound).second; - // \-- + return uno::Any(); } // ____ OPropertySet ____ -::cppu::IPropertyArrayHelper & SAL_CALL NetChartType::getInfoHelper() +::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper() { - static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - + uno::Sequence< beans::Property > aProps; + static ::cppu::OPropertyArrayHelper aArrayHelper(aProps); return aArrayHelper; } - // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL - NetChartType::getPropertySetInfo() + NetChartType_Base::getPropertySetInfo() throw (uno::RuntimeException) { static uno::Reference< beans::XPropertySetInfo > xInfo; @@ -209,6 +138,35 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL // \-- } +//----------------------------------------------------------------------------- + +NetChartType::NetChartType( + const uno::Reference< uno::XComponentContext > & xContext ) : + NetChartType_Base( xContext ) +{} + +NetChartType::NetChartType( const NetChartType & rOther ) : + NetChartType_Base( rOther ) +{ +} + +NetChartType::~NetChartType() +{} + +// ____ XCloneable ____ +uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone() + throw (uno::RuntimeException) +{ + return uno::Reference< util::XCloneable >( new NetChartType( *this )); +} + +// ____ XChartType ____ +::rtl::OUString SAL_CALL NetChartType::getChartType() + throw (uno::RuntimeException) +{ + return CHART2_SERVICE_NAME_CHARTTYPE_NET; +} + uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 3 ); diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx index f38d110a60ba..97afeeaeea13 100644 --- a/chart2/source/model/template/NetChartType.hxx +++ b/chart2/source/model/template/NetChartType.hxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NetChartType.hxx,v $ + * $RCSfile: NetChartType_Base.hxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. @@ -36,24 +36,17 @@ namespace chart { -class NetChartType : public ChartType +class NetChartType_Base : public ChartType { public: - NetChartType( ::com::sun::star::uno::Reference< + NetChartType_Base( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ); - virtual ~NetChartType(); - - APPHELPER_XSERVICEINFO_DECL() - - /// establish methods for factory instatiation - APPHELPER_SERVICE_FACTORY_HELPER( NetChartType ) + virtual ~NetChartType_Base(); protected: - explicit NetChartType( const NetChartType & rOther ); + explicit NetChartType_Base( const NetChartType_Base & rOther ); // ____ XChartType ____ - virtual ::rtl::OUString SAL_CALL getChartType() - throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL createCoordinateSystem( ::sal_Int32 DimensionCount ) throw (::com::sun::star::lang::IllegalArgumentException, @@ -63,13 +56,34 @@ protected: virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const throw(::com::sun::star::beans::UnknownPropertyException); - // ____ OPropertySet ____ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); // ____ XPropertySet ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); +}; + +//------------------------------------------------------------------------------------- + +class NetChartType : public NetChartType_Base +{ +public: + NetChartType( ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + virtual ~NetChartType(); + + APPHELPER_XSERVICEINFO_DECL() + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( NetChartType ) + +protected: + explicit NetChartType( const NetChartType & rOther ); + + // ____ XChartType ____ + virtual ::rtl::OUString SAL_CALL getChartType() + throw (::com::sun::star::uno::RuntimeException); // ____ XCloneable ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index e348b32b7bc6..9b2c089b7298 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -64,11 +64,13 @@ NetChartTypeTemplate::NetChartTypeTemplate( const ::rtl::OUString & rServiceName, StackMode eStackMode, bool bSymbols, - bool bHasLines ) : + bool bHasLines , + bool bHasFilledArea ) : ChartTypeTemplate( xContext, rServiceName ), m_eStackMode( eStackMode ), m_bHasSymbols( bSymbols ), - m_bHasLines( bHasLines ) + m_bHasLines( bHasLines ), + m_bHasFilledArea( bHasFilledArea ) {} NetChartTypeTemplate::~NetChartTypeTemplate() @@ -110,11 +112,18 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( { sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); - // check symbol-style - // for a template with symbols it is ok, if there is at least one series - // with symbols, otherwise an unknown template is too easy to achieve + uno::Reference< beans::XPropertySet > xChartTypeProp( + DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW ); + if( bResult ) { + //filled net chart?: + if( m_bHasFilledArea ) + return sal_True; + + // check symbol-style + // for a template with symbols it is ok, if there is at least one series + // with symbols, otherwise an unknown template is too easy to achieve bool bSymbolFound = false; bool bLineFound = false; @@ -182,8 +191,13 @@ Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_ { Reference< lang::XMultiServiceFactory > xFact( GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW ); - xResult.set( xFact->createInstance( - CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW ); + + if( m_bHasFilledArea ) + xResult.set( xFact->createInstance( + CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW ); + else + xResult.set( xFact->createInstance( + CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW ); } catch( uno::Exception & ex ) { diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx index 0e963b8d4500..9c17e6639497 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.hxx +++ b/chart2/source/model/template/NetChartTypeTemplate.hxx @@ -45,7 +45,8 @@ public: const ::rtl::OUString & rServiceName, StackMode eStackMode, bool bSymbols, - bool bHasLines = true + bool bHasLines = true, + bool bHasFilledArea = false ); virtual ~NetChartTypeTemplate(); @@ -80,6 +81,7 @@ private: StackMode m_eStackMode; bool m_bHasSymbols; bool m_bHasLines; + bool m_bHasFilledArea; }; } // namespace chart diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx index 6e5960410445..7b739ca73830 100644 --- a/chart2/source/model/template/_serviceregistration_charttypes.cxx +++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx @@ -39,6 +39,7 @@ #include "ColumnChartType.hxx" #include "LineChartType.hxx" #include "NetChartType.hxx" +#include "FilledNetChartType.hxx" #include "PieChartType.hxx" #include "ScatterChartType.hxx" #include "BubbleChartType.hxx" @@ -96,6 +97,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] = , 0 } ,{ + ::chart::FilledNetChartType::create + , ::chart::FilledNetChartType::getImplementationName_Static + , ::chart::FilledNetChartType::getSupportedServiceNames_Static + , ::cppu::createSingleComponentFactory + , 0 + , 0 + } + ,{ ::chart::PieChartType::create , ::chart::PieChartType::getImplementationName_Static , ::chart::PieChartType::getSupportedServiceNames_Static diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk index ad8fcd552c8d..63367014ed6b 100644 --- a/chart2/source/model/template/makefile.mk +++ b/chart2/source/model/template/makefile.mk @@ -63,6 +63,7 @@ SLOFILES= \ $(SLO)$/ColumnChartType.obj \ $(SLO)$/ColumnLineChartTypeTemplate.obj \ $(SLO)$/DataInterpreter.obj \ + $(SLO)$/FilledNetChartType.obj \ $(SLO)$/LineChartType.obj \ $(SLO)$/LineChartTypeTemplate.obj \ $(SLO)$/NetChartType.obj \ diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 357cf5c43d92..9e521fa76dae 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -106,6 +106,8 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return sal_False; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines @@ -197,6 +199,8 @@ sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChar return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return sal_False; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return sal_False; } return sal_True; } @@ -335,14 +339,21 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) { - aRet.realloc(5); + aRet.realloc(6); sal_Int32* pSeq = aRet.getArray(); + *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER; } + else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + { + aRet.realloc(1); + sal_Int32* pSeq = aRet.getArray(); + *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE; + } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) { aRet.realloc( 1 ); @@ -399,6 +410,8 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2: rtl::OUString aChartTypeName = xChartType->getChartType(); if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return false; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return false; } if( nDimensionCount==3 ) return nDimensionIndex<2; @@ -579,7 +592,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE; } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) { aRet.realloc( bStacked ? 2 : 3 ); sal_Int32* pSeq = aRet.getArray(); @@ -609,6 +623,17 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( return aRet; } +bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType ) +{ + if( xChartType.is() ) + { + rtl::OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) ) + return false; + } + return true; +} + rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType ) { rtl::OUString aRet( C2U( "values-y" ) ); diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index 692f6ee54a1b..9452763153a5 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -223,6 +223,29 @@ drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygo return aRet; } +void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd ) +{ + sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength(); + sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount; + rRet.SequenceX.realloc( nOuterCount ); + rRet.SequenceY.realloc( nOuterCount ); + rRet.SequenceZ.realloc( nOuterCount ); + + sal_Int32 nIndex = 0; + sal_Int32 nOuter = nOuterCount - nAddOuterCount; + for( ; nOuter < nOuterCount; nOuter++ ) + { + if( nIndex >= nAddOuterCount ) + break; + + rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex]; + rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex]; + rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex]; + + nIndex++; + } +} + void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd ) { sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() ); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ac2a32f93298..fbc8042af27b 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1320,6 +1320,8 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference< return false; if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return false; + if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return false; } return true; } diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 6e43ebc75b67..47cc6de405f7 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -112,7 +112,8 @@ VCoordinateSystem::~VCoordinateSystem() void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget , const Reference< drawing::XShapes >& xFinalTarget - , const Reference< lang::XMultiServiceFactory >& xShapeFactory ) + , const Reference< lang::XMultiServiceFactory >& xShapeFactory + , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis ) throw (uno::RuntimeException) { DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters"); @@ -125,12 +126,14 @@ void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing: { //create and add to target m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget ); m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget ); } else { //create and added to target m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget ); m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget ); } m_xFinalTarget = xFinalTarget; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 0b1a17ca7701..406e5d119cd6 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -45,6 +45,7 @@ #include "LabelPositionHelper.hxx" #include "Clipping.hxx" #include "Stripe.hxx" +#include "PolarLabelPositionHelper.hxx" #include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> @@ -84,6 +85,7 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel , m_bArea(!bNoArea) , m_bLine(bNoArea) , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) ) + , m_bIsPolarCooSys( bConnectLastToFirstPoint ) , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint ) , m_bAddOneToXMax(bAddOneToXMax) , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder ) @@ -230,7 +232,7 @@ bool AreaChart::keepAspectRatio() const void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot ) { - if( m_bArea && pSeries ) + if( m_bArea && !m_bIsPolarCooSys && pSeries ) { sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment(); if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) @@ -432,7 +434,12 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries drawing::PolyPolygonShape3D aPoly( *pSeriesPoly ); //add second part to the polygon (grounding points or previous series points) - if(!pPreviousSeriesPoly) + if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) + { + if( pPreviousSeriesPoly ) + addPolygon( aPoly, *pPreviousSeriesPoly ); + } + else if(!pPreviousSeriesPoly) { double fMinX = pSeries->m_fLogicMinX; double fMaxX = pSeries->m_fLogicMaxX; @@ -726,6 +733,22 @@ void AreaChart::createShapes() double fLogicX = (*aSeriesIter)->getXValue(nIndex); double fLogicY = (*aSeriesIter)->getYValue(nIndex); + if( m_bIsPolarCooSys && m_bArea && + ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) ) + { + if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) + { + if( pSeriesList->size() == 1 || nSeriesIndex == 0 ) + { + fLogicY = pPosHelper->getLogicMinY(); + if( !pPosHelper->isMathematicalOrientationY() ) + fLogicY = pPosHelper->getLogicMaxY(); + } + else + fLogicY = 0.0; + } + } + if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 ) fLogicY = fabs( fLogicY ); @@ -797,8 +820,22 @@ void AreaChart::createShapes() //store point information for series polygon //for area and/or line (symbols only do not need this) if( isValidPosition(aScaledLogicPosition) ) + { AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); + //prepare clipping for filled net charts + if( !bIsVisible && m_bIsPolarCooSys && m_bArea ) + { + drawing::Position3D aClippedPos(aScaledLogicPosition); + pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 ); + if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) ) + { + AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex ); + AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); + } + } + } + //create a single datapoint if point is visible //apply clipping: if( !bIsVisible ) @@ -909,12 +946,29 @@ void AreaChart::createShapes() break; } + awt::Point aScreenPosition2D;//get the screen position for the labels + sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent + if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE ) + { + PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper); + if( pPolarPosHelper ) + { + PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory); + aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues( + eAlignment, fLogicX, fLogicY, fLogicZ, nOffset )); + } + } + else + { + if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 ) + nOffset = 0; + aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) + .transformSceneToScreenPosition( aScenePosition3D ) ); + } - awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) - .transformSceneToScreenPosition( aScenePosition3D ) ); this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex , fLogicValueForLabeDisplay - , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment ); + , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset ); } } diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index ec56d9e2390b..ec90e92ba1a4 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -110,9 +110,11 @@ private: //member bool m_bArea;//false -> line or symbol only bool m_bLine; bool m_bSymbol; + bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different) bool m_bConnectLastToFirstPoint;//used e.g. for net chart bool m_bAddOneToXMax;//used e.g. for net chart (the angle axis needs a different autoscaling) bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts + sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic ::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1 diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index b63603ef403a..6069189ff0ac 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -111,7 +111,7 @@ void BubbleChart::calculateMaximumLogicBubbleSize() double fSize = pSeries->getBubble_Size( nIndex ); if( m_bShowNegativeValues ) - fSize = abs(fSize); + fSize = fabs(fSize); if( fSize > fMaxSize ) fMaxSize = fSize; } @@ -146,7 +146,7 @@ drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize return aRet; if( m_bShowNegativeValues ) - fLogicSize = abs(fLogicSize); + fLogicSize = fabs(fLogicSize); double fMaxSize = m_fMaxLogicBubbleSize; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 73fa9039bf44..c8f473d226d0 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1726,6 +1726,11 @@ bool VSeriesPlotter::PointsWereSkipped() const return m_bPointsWereSkipped; } +bool VSeriesPlotter::WantToPlotInFrontOfAxisLine() +{ + return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel ); +} + Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( LegendExpansion eLegendExpansion , const Reference< beans::XPropertySet >& xTextProperties @@ -2070,6 +2075,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( pRet = new PieChart(xChartTypeModel,nDimensionCount); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); + else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) pRet = new CandleStickChart(xChartTypeModel,nDimensionCount); else diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index f9a575be0123..111b1cb02f99 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -74,7 +74,9 @@ public: , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xFinalTarget , const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) + ::com::sun::star::lang::XMultiServiceFactory >& xFactory + , ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis ) throw (::com::sun::star::uno::RuntimeException); void setParticle( const rtl::OUString& rCooSysParticle ); diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index eeb561b13f02..e94ef6c68687 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -296,6 +296,8 @@ public: virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize ); + bool WantToPlotInFrontOfAxisLine(); + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 7098e150a175..dfd57f9bce92 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1377,12 +1377,13 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo drawing::Direction3D aPreferredAspectRatio( rSeriesPlotterContainer.getPreferredAspectRatio() ); - uno::Reference< drawing::XShapes > xCoordinateRegionTarget(0); + uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(0); + uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(0); VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount); {//create diagram aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory); aVDiagram.createShapes(rAvailablePos,rAvailableSize); - xCoordinateRegionTarget = aVDiagram.getCoordinateRegion(); + xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion(); aVDiagram.reduceToMimimumSize(); } @@ -1394,7 +1395,7 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo for( nC=0; nC < rVCooSysList.size(); nC++) { VCoordinateSystem* pVCooSys = rVCooSysList[nC]; - pVCooSys->initPlottingTargets(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory); + pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis); pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); @@ -1469,7 +1470,15 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo //------------ set transformation to plotter / create series VSeriesPlotter* pSeriesPlotter = *aPlotterIter; rtl::OUString aCID; //III - pSeriesPlotter->initPlotter(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory,aCID); + uno::Reference< drawing::XShapes > xSeriesTarget(0); + if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() ) + xSeriesTarget = xSeriesTargetInFrontOfAxis; + else + { + xSeriesTarget = xSeriesTargetBehindAxis; + DBG_ASSERT( !lcl_resizeAfterCompleteCreation(xDiagram), "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" ); + } + pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,aCID ); pSeriesPlotter->setPageReferenceSize( rPageSize ); VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter ); if(2==nDimensionCount) @@ -1503,7 +1512,8 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo } //clear and recreate - ShapeFactory::removeSubShapes( xCoordinateRegionTarget ); + ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here + xSeriesTargetBehindAxis.clear(); ShapeFactory::removeSubShapes( xTextTargetShapes ); //set new transformation diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index d2456110b79b..abe8fad1a942 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -151,7 +151,7 @@ void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Ref void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment ) { if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO - && ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) ) + && (::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue)) ) rfValue = 0.0; } diff --git a/chart2/source/view/makefile.mk b/chart2/source/view/makefile.mk index 58229edf1217..8ab947b9cedc 100644 --- a/chart2/source/view/makefile.mk +++ b/chart2/source/view/makefile.mk @@ -82,7 +82,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ $(SALLIB) \ $(SVLLIB) \ $(SVTOOLLIB) \ - $(SVXLIB) \ + $(SVXCORELIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) \ $(BASEGFXLIB) \ |