61#include <com/sun/star/util/CloseVetoException.hpp>
76using ::com::sun::star::uno::Reference;
81wrapper::ItemConverter* createItemConverter(
83 const uno::Reference<uno::XComponentContext>& xContext,
SdrModel& rDrawModel,
84 ExplicitValueProvider* pExplicitValueProvider, ReferenceSizeProvider
const * pRefSizeProvider )
86 wrapper::ItemConverter* pItemConverter=
nullptr;
92 OSL_FAIL(
"unknown ObjectType");
97 bool bAffectsMultipleObjects = aParticleID ==
u"ALLELEMENTS";
98 if( !bAffectsMultipleObjects )
100 uno::Reference< beans::XPropertySet > xObjectProperties =
102 if(!xObjectProperties.is())
108 pItemConverter =
new wrapper::GraphicPropertyItemConverter(
110 rDrawModel, xChartModel,
115 std::unique_ptr<awt::Size> pRefSize;
116 if (pRefSizeProvider)
117 pRefSize.reset(
new awt::Size(pRefSizeProvider->getPageSize()));
119 pItemConverter =
new wrapper::TitleItemConverter(
120 xObjectProperties, rDrawModel.
GetItemPool(), rDrawModel,
127 std::unique_ptr<awt::Size> pRefSize;
128 if (pRefSizeProvider)
129 pRefSize.reset(
new awt::Size( pRefSizeProvider->getPageSize()));
131 pItemConverter =
new wrapper::LegendItemConverter(
132 xObjectProperties, rDrawModel.
GetItemPool(), rDrawModel,
143 pItemConverter =
new wrapper::GraphicPropertyItemConverter(
145 rDrawModel, xChartModel,
150 std::unique_ptr<awt::Size> pRefSize;
151 if (pRefSizeProvider)
152 pRefSize.reset(
new awt::Size( pRefSizeProvider->getPageSize()));
158 ExplicitScaleData aExplicitScale;
159 ExplicitIncrementData aExplicitIncrement;
160 if( pExplicitValueProvider )
161 pExplicitValueProvider->getExplicitValuesForAxis(
162 dynamic_cast< Axis*
>( xObjectProperties.get() ),
163 aExplicitScale, aExplicitIncrement );
165 pItemConverter =
new wrapper::AxisItemConverter(
169 &aExplicitScale, &aExplicitIncrement,
178 std::unique_ptr<awt::Size> pRefSize;
179 if (pRefSizeProvider)
180 pRefSize.reset(
new awt::Size( pRefSizeProvider->getPageSize()));
186 sal_Int32 nNumberFormat = ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties );
187 sal_Int32 nPercentNumberFormat = ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
188 xObjectProperties, xChartModel);
190 pItemConverter =
new wrapper::TextLabelItemConverter(
191 xChartModel, xObjectProperties, xSeries,
192 rDrawModel.
GetItemPool(), pRefSize.get(), bDataSeries,
193 nNumberFormat, nPercentNumberFormat);
199 std::unique_ptr<awt::Size> pRefSize;
200 if (pRefSizeProvider)
201 pRefSize.reset(
new awt::Size( pRefSizeProvider->getPageSize()));
210 sal_Int32 nDimensionCount = xDiagram->getDimension();
217 bool bUseSpecialFillColor =
false;
218 sal_Int32 nSpecialFillColor =0;
219 sal_Int32 nPointIndex = -1;
223 bool bVaryColorsByPoint =
false;
231 bUseSpecialFillColor =
true;
232 OSL_ASSERT( xDiagram.is());
233 uno::Reference< XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
234 if( xColorScheme.is())
235 nSpecialFillColor = xColorScheme->getColorByIndex( nPointIndex );
239 sal_Int32 nNumberFormat=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties );
240 sal_Int32 nPercentNumberFormat=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
241 xObjectProperties, xChartModel);
243 pItemConverter =
new wrapper::DataPointItemConverter( xChartModel, xContext,
244 xObjectProperties, xSeries, rDrawModel.
GetItemPool(), rDrawModel,
246 eMapTo, pRefSize.get(), bDataSeries, bUseSpecialFillColor, nSpecialFillColor,
true,
247 nNumberFormat, nPercentNumberFormat, nPointIndex );
253 pItemConverter =
new wrapper::GraphicPropertyItemConverter(
255 rDrawModel, xChartModel,
262 pItemConverter =
new wrapper::ErrorBarItemConverter(
263 xChartModel, xObjectProperties, rDrawModel.
GetItemPool(),
264 rDrawModel, xChartModel);
268 pItemConverter =
new wrapper::RegressionCurveItemConverter(
276 std::unique_ptr<awt::Size> pRefSize;
277 if (pRefSizeProvider)
278 pRefSize.reset(
new awt::Size(pRefSizeProvider->getPageSize()));
280 pItemConverter =
new wrapper::RegressionEquationItemConverter(
281 xObjectProperties, rDrawModel.
GetItemPool(), rDrawModel,
290 pItemConverter =
new wrapper::GraphicPropertyItemConverter(
292 rDrawModel, xChartModel,
297 pItemConverter =
new wrapper::DataTableItemConverter(
299 rDrawModel, xChartModel);
312 pItemConverter =
new wrapper::AllTitleItemConverter( xChartModel, rDrawModel.
GetItemPool(),
313 rDrawModel, xChartModel);
317 std::unique_ptr<awt::Size> pRefSize;
318 if (pRefSizeProvider)
319 pRefSize.reset(
new awt::Size( pRefSizeProvider->getPageSize()));
321 pItemConverter =
new wrapper::AllAxisItemConverter(
323 rDrawModel, pRefSize.get());
328 pItemConverter =
new wrapper::AllGridItemConverter( xChartModel, rDrawModel.
GetItemPool(),
329 rDrawModel, xChartModel);
336 return pItemConverter;
341 if( rDispatchCommand ==
"AllTitles")
345 if( rDispatchCommand ==
"SubTitle" )
347 else if( rDispatchCommand ==
"XTitle" )
349 else if( rDispatchCommand ==
"YTitle" )
351 else if( rDispatchCommand ==
"ZTitle" )
353 else if( rDispatchCommand ==
"SecondaryXTitle" )
355 else if( rDispatchCommand ==
"SecondaryYTitle" )
364 if( rDispatchCommand ==
"DiagramAxisAll")
367 sal_Int32 nDimensionIndex=0;
369 if( rDispatchCommand ==
"DiagramAxisX")
371 nDimensionIndex=0; bMainAxis=
true;
373 else if( rDispatchCommand ==
"DiagramAxisY")
375 nDimensionIndex=1; bMainAxis=
true;
377 else if( rDispatchCommand ==
"DiagramAxisZ")
379 nDimensionIndex=2; bMainAxis=
true;
381 else if( rDispatchCommand ==
"DiagramAxisA")
383 nDimensionIndex=0; bMainAxis=
false;
385 else if( rDispatchCommand ==
"DiagramAxisB")
387 nDimensionIndex=1; bMainAxis=
false;
399 if( rDispatchCommand ==
"DiagramGridAll")
402 sal_Int32 nDimensionIndex=0;
407 if( rDispatchCommand ==
"DiagramGridYMain")
409 nDimensionIndex=0; bMainGrid=
true;
411 else if( rDispatchCommand ==
"DiagramGridXMain")
413 nDimensionIndex=1; bMainGrid=
true;
415 else if( rDispatchCommand ==
"DiagramGridZMain")
417 nDimensionIndex=2; bMainGrid=
true;
419 else if( rDispatchCommand ==
"DiagramGridYHelp")
421 nDimensionIndex=0; bMainGrid=
false;
423 else if( rDispatchCommand ==
"DiagramGridXHelp")
425 nDimensionIndex=1; bMainGrid=
false;
427 else if( rDispatchCommand ==
"DiagramGridZHelp")
429 nDimensionIndex=2; bMainGrid=
false;
434 sal_Int32 nSubGridIndex= bMainGrid ? -1 : 0;
439OUString lcl_getErrorCIDForCommand(
const ObjectType eDispatchType,
const ObjectType &eSelectedType,
const OUString &rSelectedCID)
441 if( eSelectedType == eDispatchType )
455 if( rDispatchCommand ==
"Legend" || rDispatchCommand ==
"FormatLegend" )
461 else if( rDispatchCommand ==
"DiagramWall" || rDispatchCommand ==
"FormatWall" )
467 else if( rDispatchCommand ==
"DiagramFloor" || rDispatchCommand ==
"FormatFloor" )
472 else if( rDispatchCommand ==
"DiagramArea" || rDispatchCommand ==
"FormatChartArea" )
477 else if( rDispatchCommand ==
"MainTitle"
478 || rDispatchCommand ==
"SubTitle"
479 || rDispatchCommand ==
"XTitle"
480 || rDispatchCommand ==
"YTitle"
481 || rDispatchCommand ==
"ZTitle"
482 || rDispatchCommand ==
"SecondaryXTitle"
483 || rDispatchCommand ==
"SecondaryYTitle"
484 || rDispatchCommand ==
"AllTitles"
487 return lcl_getTitleCIDForCommand( rDispatchCommand, xChartDocument );
490 else if( rDispatchCommand ==
"DiagramAxisX"
491 || rDispatchCommand ==
"DiagramAxisY"
492 || rDispatchCommand ==
"DiagramAxisZ"
493 || rDispatchCommand ==
"DiagramAxisA"
494 || rDispatchCommand ==
"DiagramAxisB"
495 || rDispatchCommand ==
"DiagramAxisAll"
498 return lcl_getAxisCIDForCommand( rDispatchCommand, xChartDocument );
501 else if( rDispatchCommand ==
"DiagramGridYMain"
502 || rDispatchCommand ==
"DiagramGridXMain"
503 || rDispatchCommand ==
"DiagramGridZMain"
504 || rDispatchCommand ==
"DiagramGridYHelp"
505 || rDispatchCommand ==
"DiagramGridXHelp"
506 || rDispatchCommand ==
"DiagramGridZHelp"
507 || rDispatchCommand ==
"DiagramGridAll"
510 return lcl_getGridCIDForCommand( rDispatchCommand, xChartDocument );
513 else if( rDispatchCommand ==
"FormatDataSeries" )
522 else if( rDispatchCommand ==
"FormatDataPoint" )
527 else if( rDispatchCommand ==
"FormatDataLabels" )
536 else if( rDispatchCommand ==
"FormatDataLabel" )
556 else if( rDispatchCommand ==
"FormatMeanValue" )
567 else if( rDispatchCommand ==
"FormatTrendline" )
578 else if( rDispatchCommand ==
"FormatTrendlineEquation" )
589 else if( rDispatchCommand ==
"FormatXErrorBars" )
594 else if( rDispatchCommand ==
"FormatYErrorBars" )
599 else if( rDispatchCommand ==
"FormatAxis" )
610 else if( rDispatchCommand ==
"FormatMajorGrid" )
622 else if( rDispatchCommand ==
"FormatMinorGrid" )
633 else if( rDispatchCommand ==
"FormatTitle" )
639 else if( rDispatchCommand ==
"FormatStockLoss" )
647 else if( rDispatchCommand ==
"FormatStockGain" )
679OUString lcl_getFormatCIDforSelectedCID(
const OUString& rSelectedCID )
681 OUString aFormatCID(rSelectedCID);
704 OUString aObjectCID = lcl_getFormatCIDforSelectedCID( rSelectedObjectCID );
717 const OUString& rObjectCID,
bool bSuccessOnUnchanged )
721 if( rObjectCID.isEmpty() )
743 std::unique_ptr<wrapper::ItemConverter> pItemConverter(
747 pRefSizeProv.get()));
752 SfxItemSet aItemSet = pItemConverter->CreateEmptyItemSet();
757 pItemConverter->FillItemSet(aItemSet);
767 &aViewElementListProvider,
782 aSymbolItemConverter.
FillItemSet( aSymbolShapeProperties );
784 sal_Int32
const nStandardSymbol=0;
785 std::optional<Graphic> oAutoSymbolGraphic(std::in_place, aViewElementListProvider.
GetSymbolGraphic( nStandardSymbol, &aSymbolShapeProperties ) );
802 (void)pItemConverter->ApplyItemSet(*pOutItemSet);
807 catch(
const util::CloseVetoException& )
810 catch(
const uno::RuntimeException& )
821 SchResId( STR_ACTION_EDIT_3D_VIEW ),
830 catch(
const uno::RuntimeException&)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_STAT_ERRORBAR_TYPE(SCHATTR_STAT_START+9)
static OUString createDescription(ActionType eActionType, std::u16string_view rObjectName)
const SfxItemPool & GetItemPool() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual short run() override
const SfxItemSet * GetOutputItemSet() const
static rtl::Reference< ::chart::Axis > getAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
void executeDispatch_View3D()
rtl::Reference<::chart::ChartModel > getChartModel()
void executeDispatch_ObjectProperties()
css::uno::Reference< css::document::XUndoManager > m_xUndoManager
void executeDlg_ObjectProperties(const OUString &rObjectCID)
std::unique_ptr< ReferenceSizeProvider > impl_createReferenceSizeProvider()
std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper
rtl::Reference<::chart::ChartView > m_xChartView
weld::Window * GetChartFrame()
bool executeDlg_ObjectProperties_withoutUndoGuard(const OUString &rObjectCID, bool bSuccessOnUnchanged)
rtl::Reference<::chart::Diagram > getFirstDiagram()
void executeDispatch_FormatObject(std::u16string_view rDispatchCommand)
css::uno::Reference< css::uno::XComponentContext > m_xCC
static rtl::Reference< ChartType > getChartTypeOfSeries(const rtl::Reference<::chart::ChartModel > &xModel, const rtl::Reference< ::chart::DataSeries > &xGivenDataSeries)
static bool isSupportingAreaProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool hasPointOwnColor(const rtl::Reference< ::chart::DataSeries > &xDataSeries, sal_Int32 nPointIndex, const css::uno::Reference< css::beans::XPropertySet > &xDataPointProperties)
This guard calls lockControllers at the given Model in the CTOR and unlockControllers in the DTOR.
static double getAxisMinorStepWidthForErrorBarDecimals(const rtl::Reference<::chart::ChartModel > &xChartModel, const rtl::Reference<::chart::ChartView > &xChartView, std::u16string_view rSelectedObjectCID)
static OUString createClassifiedIdentifierForParticle(std::u16string_view rParticle)
static OUString getSeriesParticleFromCID(std::u16string_view rCID)
static OUString createDataCurveEquationCID(std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex)
static rtl::Reference< ::chart::DataSeries > getDataSeriesForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
static OUString getStringForType(ObjectType eObjectType)
static OUString createDataCurveCID(std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine)
static std::u16string_view getParticleID(std::u16string_view rCID)
static OUString createClassifiedIdentifier(enum ObjectType eObjectType, std::u16string_view rParticleID)
static css::uno::Reference< css::beans::XPropertySet > getObjectPropertySet(std::u16string_view rObjectCID, const rtl::Reference< ::chart::ChartModel > &xChartDocument)
static OUString createClassifiedIdentifierForParticles(std::u16string_view rParentParticle, std::u16string_view rChildParticle, std::u16string_view rDragMethodServiceName=std::u16string_view(), std::u16string_view rDragParameterString=std::u16string_view())
static rtl::Reference< ::chart::Axis > getAxisForCID(std::u16string_view rObjectCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
static OUString createClassifiedIdentifierWithParent(enum ObjectType, std::u16string_view rParticleID, std::u16string_view rParentPartical, std::u16string_view rDragMethodServiceName=std::u16string_view(), std::u16string_view rDragParameterString=std::u16string_view())
static OUString createPointCID(std::u16string_view rPointCID_Stub, sal_Int32 nIndex)
static std::u16string_view getFullParentParticle(std::u16string_view rCID)
static OUString createClassifiedIdentifierForGrid(const css::uno::Reference< css::chart2::XAxis > &xAxis, const rtl::Reference<::chart::ChartModel > &xChartModel, sal_Int32 nSubIndex=-1)
ObjectType getObjectType() const
static OUString createClassifiedIdentifierForObject(const css::uno::Reference< css::uno::XInterface > &xObject, const rtl::Reference<::chart::ChartModel > &xChartModel)
static OUString getName(ObjectType eObjectType, bool bPlural=false)
void init(const rtl::Reference<::chart::ChartModel > &xModel)
bool HasStatisticProperties() const
bool HasSymbolProperties() const
bool DialogWasClosedWithOK() const
void setSymbolInformation(SfxItemSet &&rSymbolShapeProperties, std::optional< Graphic > oAutoSymbolGraphic)
void SetAxisMinorStepWidthForErrorBarDecimals(double fMinorStepWidth)
OUString const & getSelectedCID() const
static rtl::Reference< ::chart::Title > getTitle(eTitleType nTitleIndex, ChartModel &rModel)
A guard which does nothing, unless you explicitly call commitAction.
A guard which, in its destructor, restores the model state it found in the constructor.
virtual short run() override
Graphic GetSymbolGraphic(sal_Int32 nStandardSymbol, const SfxItemSet *pSymbolShapeProperties) const
virtual void FillItemSet(SfxItemSet &rOutItemSet) const override
applies all properties that can be mapped to items into the given item set.
SfxItemSet CreateEmptyItemSet() const
creates an empty item set using the given pool or a common pool if empty (see GetItemPool) and allowi...
#define TOOLS_WARN_EXCEPTION(area, stream)
@ PROP_DATASERIES_VARY_COLORS_BY_POINT
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > getFirstCurveNotMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xCurveContainer)
Returns the first regression curve found that is not of type mean-value line.
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > getMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xRegCnt)
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getRegressionCurveIndex(const rtl::Reference<::chart::DataSeries > &xContainer, const rtl::Reference<::chart::RegressionCurveModel > &xCurve)
@ OBJECTTYPE_LEGEND_ENTRY
@ OBJECTTYPE_DATA_ERRORS_X
@ OBJECTTYPE_DATA_STOCK_LOSS
@ OBJECTTYPE_DIAGRAM_FLOOR
@ OBJECTTYPE_DATA_STOCK_RANGE
@ OBJECTTYPE_DATA_ERRORS_Y
@ OBJECTTYPE_AXIS_UNITLABEL
@ OBJECTTYPE_DATA_CURVE_EQUATION
@ OBJECTTYPE_DATA_STOCK_GAIN
@ OBJECTTYPE_DATA_AVERAGE_LINE
@ OBJECTTYPE_DATA_ERRORS_Z
@ OBJECTTYPE_DIAGRAM_WALL
OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(TranslateId aId)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)