diff options
Diffstat (limited to 'chart2/source/controller/dialogs/dlg_ObjectProperties.cxx')
-rw-r--r-- | chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 110 |
1 files changed, 62 insertions, 48 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index a356c1ac4185..e885fdaef32e 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> + #include <dlg_ObjectProperties.hxx> #include <strings.hrc> #include "tp_AxisLabel.hxx" @@ -31,23 +35,29 @@ #include "tp_TitleRotation.hxx" #include "tp_PolarOptions.hxx" #include "tp_DataPointOption.hxx" +#include "tp_DataTable.hxx" #include <ResId.hxx> #include <ViewElementListProvider.hxx> #include <ChartModelHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ObjectNameProvider.hxx> +#include <DataSeries.hxx> #include <DiagramHelper.hxx> +#include <Diagram.hxx> #include <NumberFormatterWrapper.hxx> +#include <Axis.hxx> #include <AxisHelper.hxx> #include <ExplicitCategoriesProvider.hxx> #include <ChartModel.hxx> #include <CommonConverters.hxx> #include <RegressionCalculationHelper.hxx> +#include <BaseCoordinateSystem.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <svl/intitem.hxx> -#include <svl/languageoptions.hxx> +#include <svl/ctloptions.hxx> #include <svx/svxids.hrc> @@ -62,7 +72,8 @@ #include <svx/numinf.hxx> #include <svl/cjkoptions.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> namespace com::sun::star::chart2 { class XChartType; } namespace com::sun::star::chart2 { class XDataSeries; } @@ -77,11 +88,10 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::beans::XPropertySet; -ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString& rObjectCID ) - : m_aObjectCID( rObjectCID ) +ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( OUString aObjectCID ) + : m_aObjectCID(std::move( aObjectCID )) , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) ) , m_bAffectsMultipleObjects(false) - , m_aLocalizedName() , m_bHasGeometryProperties(false) , m_bHasStatisticProperties(false) , m_bProvidesSecondaryYAxis(false) @@ -99,24 +109,25 @@ ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString , m_bShowAxisOrigin(false) , m_bIsCrossingAxisIsCategoryAxis(false) , m_bSupportingCategoryPositioning(false) - , m_aCategories() , m_bComplexCategoriesAxis( false ) , m_nNbPoints( 0 ) { - OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID ); - m_bAffectsMultipleObjects = (aParticleID == "ALLELEMENTS"); + std::u16string_view aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID ); + m_bAffectsMultipleObjects = (aParticleID == u"ALLELEMENTS"); } ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter() { } -void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel ) +void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartModel>& xChartModel ) { - m_xChartDocument.set( xChartModel, uno::UNO_QUERY ); - uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); - uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel ); - uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + m_xChartDocument = xChartModel; + rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram(); + rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel ); + rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); + sal_Int32 nDimensionCount = 0; + if (xDiagram) + nDimensionCount = xDiagram->getDimension(); bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES); bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT); @@ -153,7 +164,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if( m_bHasScaleProperties ) { - uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ); if( xAxis.is() ) { //no scale page for series axis @@ -164,7 +175,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel m_bHasNumberProperties = true; //is the crossing main axis a category axes?: - uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); + rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) ); if( xCrossingMainAxis.is() ) { @@ -172,9 +183,8 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY ); if( m_bIsCrossingAxisIsCategoryAxis ) { - ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get()); - if (pModel) - m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel ); + if (xChartModel) + m_aCategories = DiagramHelper::getExplicitSimpleCategories( *xChartModel ); } } @@ -193,10 +203,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) ) { - ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get()); - if (pModel) + if (xChartModel) { - ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel ); + ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *xChartModel ); m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories(); } @@ -213,14 +222,12 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if( m_eObjectType == OBJECTTYPE_DATA_CURVE ) { - uno::Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY ); - Sequence< Reference< data::XLabeledDataSequence > > aDataSeqs( xSource->getDataSequences()); + const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSeqs( xSeries->getDataSequences2()); Sequence< double > aXValues, aYValues; bool bXValuesFound = false, bYValuesFound = false; m_nNbPoints = 0; - sal_Int32 i = 0; - for( i=0; - ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.getLength(); + for( std::size_t i=0; + ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.size(); ++i ) { try @@ -252,8 +259,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel // initialize with 1, 2, ... //first category (index 0) matches with real number 1.0 aXValues.realloc( aYValues.getLength() ); - for( i=0; i<aXValues.getLength(); ++i ) - aXValues[i] = i+1; + auto pXValues = aXValues.getArray(); + for( sal_Int32 i=0; i<aXValues.getLength(); ++i ) + pXValues[i] = i+1; bXValuesFound = true; } @@ -309,11 +317,11 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel const sal_uInt16 nNoArrowNoShadowDlg = 1101; -void SchAttribTabDlg::setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties, - std::unique_ptr<Graphic> pAutoSymbolGraphic ) +void SchAttribTabDlg::setSymbolInformation( SfxItemSet&& rSymbolShapeProperties, + std::optional<Graphic> oAutoSymbolGraphic ) { - m_pSymbolShapeProperties = std::move(pSymbolShapeProperties); - m_pAutoSymbolGraphic = std::move(pAutoSymbolGraphic); + m_oSymbolShapeProperties.emplace(std::move(rSymbolShapeProperties)); + m_oAutoSymbolGraphic = std::move(oAutoSymbolGraphic); } void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) @@ -338,8 +346,6 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, m_xDialog->set_title(pDialogParameter->getLocalizedName()); - SvtCJKOptions aCJKOptions; - switch (pDialogParameter->getObjectType()) { case OBJECTTYPE_TITLE: @@ -349,7 +355,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("alignment", SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -360,7 +366,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("legendpos", SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create); - if (aCJKOptions.IsAsianTypographyEnabled()) + if (SvtCJKOptions::IsAsianTypographyEnabled()) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -390,7 +396,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("datalabels", SchResId(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create); AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -409,7 +415,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT); AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; } @@ -455,6 +461,13 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, case OBJECTTYPE_UNKNOWN: // nothing break; + case OBJECTTYPE_DATA_TABLE: + AddTabPage("datatable", SchResId(STR_DATA_TABLE), DataTableTabPage::Create); + AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE); + AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA); + AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); + AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); + break; case OBJECTTYPE_DATA_CURVE_EQUATION: AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE); AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA); @@ -462,7 +475,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT); - if (SvtLanguageOptions().IsCTLFontEnabled()) + if (SvtCTLOptions::IsCTLFontEnabled()) { /* When rotation is supported for equation text boxes, use SchAlignmentTabPage::Create here. The special @@ -484,7 +497,7 @@ SchAttribTabDlg::~SchAttribTabDlg() { } -void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage) +void SchAttribTabDlg::PageCreated(const OUString& rId, SfxTabPage &rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (rId == "border") @@ -498,10 +511,10 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage) if( m_pParameter->HasSymbolProperties() ) { aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList())); - if( m_pSymbolShapeProperties ) - aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties)); - if( m_pAutoSymbolGraphic ) - aSet.Put(SvxGraphicItem(*m_pAutoSymbolGraphic)); + if( m_oSymbolShapeProperties ) + aSet.Put(SfxTabDialogItem(SID_ATTR_SET, *m_oSymbolShapeProperties)); + if( m_oAutoSymbolGraphic ) + aSet.Put(SvxGraphicItem(*m_oAutoSymbolGraphic)); } rPage.PageCreated(aSet); } @@ -535,8 +548,9 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage) else if (rId == "axislabel") { bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered(); - static_cast<SchAxisLabelTabPage&>(rPage).ShowStaggeringControls( bShowStaggeringControls ); - dynamic_cast< SchAxisLabelTabPage& >( rPage ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() ); + auto & rLabelPage = static_cast<SchAxisLabelTabPage&>(rPage); + rLabelPage.ShowStaggeringControls( bShowStaggeringControls ); + rLabelPage.SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() ); } else if (rId == "axispos") { @@ -570,7 +584,7 @@ void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage) } else if (rId == "numberformat") { - aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO))); + aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO)); rPage.PageCreated(aSet); } else if (rId == "xerrorbar") |