chart2/Library_chart2.mk | 2 chart2/source/inc/servicenames_charttypes.hxx | 2 chart2/source/model/template/ChartTypeManager.cxx | 8 chart2/source/model/template/FunnelChartType.cxx | 75 +++++ chart2/source/model/template/FunnelChartType.hxx | 40 +++ chart2/source/model/template/FunnelChartTypeTemplate.cxx | 193 +++++++++++++++ chart2/source/model/template/FunnelChartTypeTemplate.hxx | 61 ++++ oox/inc/drawingml/chart/typegroupconverter.hxx | 4 oox/source/core/contexthandler2.cxx | 3 oox/source/core/xmlfilterbase.cxx | 2 oox/source/drawingml/chart/chartspacefragment.cxx | 4 oox/source/drawingml/chart/plotareacontext.cxx | 4 oox/source/drawingml/chart/typegroupconverter.cxx | 5 oox/source/drawingml/graphicshapecontext.cxx | 6 oox/source/token/namespaces-strict.txt | 2 oox/source/token/namespaces.hxx.tail | 2 oox/source/token/namespaces.txt | 2 17 files changed, 407 insertions(+), 8 deletions(-)
New commits: commit abc8ea2da28b17a4a4784830fe74fd2743f8a131 Author: knordback <kurt.nordb...@collabora.com> AuthorDate: Fri Mar 7 12:55:37 2025 -0700 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Apr 17 11:01:09 2025 +0200 tdf#165742 Step 2: Create a ChartType derived class for chartex funnel chart. This is a subtask of tdf#165742: Chartex charts are lost on input from OOXML and re-export. Create ChartType and ChartTypeTemplate derived classes for funnel chart. Change-Id: I6019412c59e0228bf37a893ced7617a4e3056add Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183461 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Jenkins diff --git a/chart2/Library_chart2.mk b/chart2/Library_chart2.mk index d0b35be117aa..6af90e1bc0e5 100644 --- a/chart2/Library_chart2.mk +++ b/chart2/Library_chart2.mk @@ -317,6 +317,8 @@ $(eval $(call gb_Library_add_exception_objects,chart2,\ chart2/source/model/template/ColumnLineDataInterpreter \ chart2/source/model/template/DataInterpreter \ chart2/source/model/template/FilledNetChartType \ + chart2/source/model/template/FunnelChartType \ + chart2/source/model/template/FunnelChartTypeTemplate \ chart2/source/model/template/HistogramChartType \ chart2/source/model/template/HistogramChartTypeTemplate \ chart2/source/model/template/HistogramDataInterpreter \ diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx index 2ef665a0254f..fe4bcb1126bf 100644 --- a/chart2/source/inc/servicenames_charttypes.hxx +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -42,5 +42,7 @@ inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK = u"com.sun.star.chart2.CandleStickChartType"_ustr; inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE = u"com.sun.star.chart2.BubbleChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_FUNNEL + = u"com.sun.star.chart2.FunnelChartType"_ustr; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index deb70d9aa03c..8baf3682ecac 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -30,6 +30,7 @@ #include "StockChartTypeTemplate.hxx" #include "NetChartTypeTemplate.hxx" #include "BubbleChartTypeTemplate.hxx" +#include "FunnelChartTypeTemplate.hxx" #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/lang/XServiceName.hpp> @@ -118,6 +119,7 @@ enum TemplateId TEMPLATE_STOCKVOLUMELOWHIGHCLOSE, TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE, TEMPLATE_BUBBLE, + TEMPLATE_FUNNEL, // TEMPLATE_SURFACE, // TEMPLATE_ADDIN, TEMPLATE_NOT_FOUND = 0xffff @@ -196,6 +198,7 @@ const tTemplateMapType & lcl_DefaultChartTypeMap() {"com.sun.star.chart2.template.StockVolumeLowHighClose", TEMPLATE_STOCKVOLUMELOWHIGHCLOSE}, {"com.sun.star.chart2.template.StockVolumeOpenLowHighClose", TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE}, {"com.sun.star.chart2.template.Bubble", TEMPLATE_BUBBLE}, + {"com.sun.star.chart2.template.Funnel", TEMPLATE_FUNNEL}, // {"com.sun.star.chart2.template.Surface", TEMPLATE_SURFACE}, // {"com.sun.star.chart2.template.Addin", TEMPLATE_ADDIN}, }; @@ -532,6 +535,11 @@ rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate( xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier )); break; + // Funnel chart + case TEMPLATE_FUNNEL: + xTemplate.set( new FunnelChartTypeTemplate( m_xContext, + aServiceSpecifier)); + break; case TEMPLATE_NOT_FOUND: SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier ); assert(false); diff --git a/chart2/source/model/template/FunnelChartType.cxx b/chart2/source/model/template/FunnelChartType.cxx new file mode 100644 index 000000000000..d9ffe231063f --- /dev/null +++ b/chart2/source/model/template/FunnelChartType.cxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "FunnelChartType.hxx" +#include <servicenames_charttypes.hxx> +#include <cppuhelper/supportsservice.hxx> + +namespace com::sun::star::uno +{ +class XComponentContext; +} + +using namespace ::com::sun::star; + +namespace chart +{ +FunnelChartType::FunnelChartType() {} + +FunnelChartType::FunnelChartType(const FunnelChartType& rOther) + : ChartType(rOther) +{ +} + +FunnelChartType::~FunnelChartType() {} + +// ____ XCloneable ____ +uno::Reference<util::XCloneable> SAL_CALL FunnelChartType::createClone() +{ + return uno::Reference<util::XCloneable>(new FunnelChartType(*this)); +} + +rtl::Reference<ChartType> FunnelChartType::cloneChartType() const +{ + return new FunnelChartType(*this); +} + +// ____ XChartType ____ +OUString SAL_CALL FunnelChartType::getChartType() { return CHART2_SERVICE_NAME_CHARTTYPE_FUNNEL; } + +uno::Sequence<OUString> FunnelChartType::getSupportedPropertyRoles() +{ + return { "FillColor", "BorderColor" }; +} + +OUString SAL_CALL FunnelChartType::getImplementationName() +{ + return "com.sun.star.comp.chart.FunnelChartType"; +} + +sal_Bool SAL_CALL FunnelChartType::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence<OUString> SAL_CALL FunnelChartType::getSupportedServiceNames() +{ + return { CHART2_SERVICE_NAME_CHARTTYPE_FUNNEL, "com.sun.star.chart2.ChartType" }; +} + +} // namespace chart + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_chart_FunnelChartType_get_implementation(css::uno::XComponentContext* /*context*/, + css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new ::chart::FunnelChartType); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/template/FunnelChartType.hxx b/chart2/source/model/template/FunnelChartType.hxx new file mode 100644 index 000000000000..fbaa3f46354d --- /dev/null +++ b/chart2/source/model/template/FunnelChartType.hxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <ChartType.hxx> + +namespace chart +{ +class FunnelChartType final : public ChartType +{ +public: + explicit FunnelChartType(); + virtual ~FunnelChartType() override; + + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + virtual rtl::Reference<ChartType> cloneChartType() const override; + +private: + explicit FunnelChartType(const FunnelChartType& rOther); + + // ____ XChartType ____ + virtual OUString SAL_CALL getChartType() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedPropertyRoles() override; + + // ____ XCloneable ____ + virtual css::uno::Reference<css::util::XCloneable> SAL_CALL createClone() override; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/template/FunnelChartTypeTemplate.cxx b/chart2/source/model/template/FunnelChartTypeTemplate.cxx new file mode 100644 index 000000000000..af026df10565 --- /dev/null +++ b/chart2/source/model/template/FunnelChartTypeTemplate.cxx @@ -0,0 +1,193 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "FunnelChartTypeTemplate.hxx" +#include "ColumnChartType.hxx" +#include <Diagram.hxx> +#include <DiagramHelper.hxx> +#include <DataSeries.hxx> +#include <DataSeriesHelper.hxx> +#include <PropertyHelper.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/chart2/DataPointGeometry3D.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <comphelper/diagnose_ex.hxx> + +#include <algorithm> + +using namespace ::com::sun::star; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::beans::Property; + +namespace +{ +enum +{ + PROP_FUNNEL_TEMPLATE_DIMENSION, + PROP_FUNNEL_TEMPLATE_GEOMETRY3D +}; + +void lcl_AddPropertiesToVector(std::vector<Property>& rOutProperties) +{ + rOutProperties.emplace_back( + "Dimension", PROP_FUNNEL_TEMPLATE_DIMENSION, cppu::UnoType<sal_Int32>::get(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT); + rOutProperties.emplace_back( + "Geometry3D", PROP_FUNNEL_TEMPLATE_GEOMETRY3D, cppu::UnoType<sal_Int32>::get(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT); +} + +::cppu::OPropertyArrayHelper& StaticFunnelChartTypeTemplateInfoHelper() +{ + static ::cppu::OPropertyArrayHelper aPropHelper = []() { + std::vector<css::beans::Property> aProperties; + lcl_AddPropertiesToVector(aProperties); + + std::sort(aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess()); + + return comphelper::containerToSequence(aProperties); + }(); + return aPropHelper; +}; + +} // anonymous namespace + +namespace chart +{ +FunnelChartTypeTemplate::FunnelChartTypeTemplate(Reference<uno::XComponentContext> const& xContext, + const OUString& rServiceName, + sal_Int32 nDim /* = 2 */) + : ChartTypeTemplate(xContext, rServiceName) + , m_nDim(nDim) +{ +} + +FunnelChartTypeTemplate::~FunnelChartTypeTemplate() {} + +sal_Int32 FunnelChartTypeTemplate::getDimension() const { return m_nDim; } + +// ____ ChartTypeTemplate ____ +bool FunnelChartTypeTemplate::matchesTemplate2(const rtl::Reference<::chart::Diagram>& xDiagram, + bool bAdaptProperties) +{ + bool bResult = ChartTypeTemplate::matchesTemplate2(xDiagram, bAdaptProperties); + + // adapt solid-type of template according to values in series + if (bAdaptProperties && bResult && getDimension() == 3) + { + bool bGeomFound = false, bGeomAmbiguous = false; + sal_Int32 aCommonGeom = xDiagram->getGeometry3D(bGeomFound, bGeomAmbiguous); + + if (!bGeomAmbiguous) + { + setFastPropertyValue_NoBroadcast(PROP_FUNNEL_TEMPLATE_GEOMETRY3D, + uno::Any(aCommonGeom)); + } + } + + return bResult; +} + +rtl::Reference<ChartType> + FunnelChartTypeTemplate::getChartTypeForIndex(sal_Int32 /*nChartTypeIndex*/) +{ + return new ColumnChartType(); +} + +rtl::Reference<ChartType> FunnelChartTypeTemplate::getChartTypeForNewSeries2( + const std::vector<rtl::Reference<ChartType>>& aFormerlyUsedChartTypes) +{ + rtl::Reference<ChartType> xResult(getChartTypeForIndex(0)); + ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem(aFormerlyUsedChartTypes, xResult); + return xResult; +} + +// ____ OPropertySet ____ +void FunnelChartTypeTemplate::GetDefaultValue(sal_Int32 nHandle, uno::Any& rAny) const +{ + static ::chart::tPropertyValueMap aStaticDefaults = []() { + ::chart::tPropertyValueMap aTmp; + ::chart::PropertyHelper::setPropertyValueDefault<sal_Int32>( + aTmp, PROP_FUNNEL_TEMPLATE_DIMENSION, 2); + ::chart::PropertyHelper::setPropertyValueDefault(aTmp, PROP_FUNNEL_TEMPLATE_GEOMETRY3D, + ::chart2::DataPointGeometry3D::CUBOID); + return aTmp; + }(); + tPropertyValueMap::const_iterator aFound(aStaticDefaults.find(nHandle)); + if (aFound == aStaticDefaults.end()) + rAny.clear(); + else + rAny = (*aFound).second; +} + +::cppu::IPropertyArrayHelper& SAL_CALL FunnelChartTypeTemplate::getInfoHelper() +{ + return StaticFunnelChartTypeTemplateInfoHelper(); +} + +// ____ XPropertySet ____ +Reference<beans::XPropertySetInfo> SAL_CALL FunnelChartTypeTemplate::getPropertySetInfo() +{ + static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo( + StaticFunnelChartTypeTemplateInfoHelper())); + return xPropertySetInfo; +} + +void FunnelChartTypeTemplate::applyStyle2(const rtl::Reference<DataSeries>& xSeries, + ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount) +{ + ChartTypeTemplate::applyStyle2(xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount); + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, "BorderStyle", + uno::Any(drawing::LineStyle_NONE)); + if (getDimension() != 3) + return; + + try + { + //apply Geometry3D + uno::Any aAGeometry3D; + getFastPropertyValue(aAGeometry3D, PROP_FUNNEL_TEMPLATE_GEOMETRY3D); + DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints(xSeries, "Geometry3D", + aAGeometry3D); + } + catch (const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } +} + +void FunnelChartTypeTemplate::resetStyles2(const rtl::Reference<::chart::Diagram>& xDiagram) +{ + ChartTypeTemplate::resetStyles2(xDiagram); + std::vector<rtl::Reference<DataSeries>> aSeriesVec(xDiagram->getDataSeries()); + uno::Any aLineStyleAny(drawing::LineStyle_NONE); + for (auto const& series : aSeriesVec) + { + if (getDimension() == 3) + series->setPropertyToDefault("Geometry3D"); + if (series->getPropertyValue("BorderStyle") == aLineStyleAny) + { + series->setPropertyToDefault("BorderStyle"); + } + } + + xDiagram->setVertical(false); +} + +IMPLEMENT_FORWARD_XINTERFACE2(FunnelChartTypeTemplate, ChartTypeTemplate, OPropertySet) +IMPLEMENT_FORWARD_XTYPEPROVIDER2(FunnelChartTypeTemplate, ChartTypeTemplate, OPropertySet) + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/template/FunnelChartTypeTemplate.hxx b/chart2/source/model/template/FunnelChartTypeTemplate.hxx new file mode 100644 index 000000000000..ffaefeace151 --- /dev/null +++ b/chart2/source/model/template/FunnelChartTypeTemplate.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + +#include <OPropertySet.hxx> +#include <comphelper/uno3.hxx> + +#include <ChartTypeTemplate.hxx> + +namespace chart +{ +class FunnelChartTypeTemplate : public ChartTypeTemplate, public ::property::OPropertySet +{ +public: + FunnelChartTypeTemplate(css::uno::Reference<css::uno::XComponentContext> const& xContext, + const OUString& rServiceName, sal_Int32 nDim = 2); + virtual ~FunnelChartTypeTemplate() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + // ____ OPropertySet ____ + virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any& rAny) const override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference<css::beans::XPropertySetInfo> + SAL_CALL getPropertySetInfo() override; + + // ____ ChartTypeTemplate ____ + virtual bool matchesTemplate2(const rtl::Reference<::chart::Diagram>& xDiagram, + bool bAdaptProperties) override; + virtual rtl::Reference<::chart::ChartType> getChartTypeForNewSeries2( + const std::vector<rtl::Reference<::chart::ChartType>>& aFormerlyUsedChartTypes) override; + virtual void applyStyle2(const rtl::Reference<::chart::DataSeries>& xSeries, + ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount) override; + virtual void resetStyles2(const rtl::Reference<::chart::Diagram>& xDiagram) override; + + // ____ ChartTypeTemplate ____ + virtual sal_Int32 getDimension() const override; + + virtual rtl::Reference<::chart::ChartType> + getChartTypeForIndex(sal_Int32 nChartTypeIndex) override; + +private: + sal_Int32 m_nDim; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/typegroupconverter.hxx b/oox/inc/drawingml/chart/typegroupconverter.hxx index c77959bfd35b..4935eeb9db7b 100644 --- a/oox/inc/drawingml/chart/typegroupconverter.hxx +++ b/oox/inc/drawingml/chart/typegroupconverter.hxx @@ -49,6 +49,7 @@ enum TypeId TYPEID_SCATTER, /// Scatter (XY) chart. TYPEID_BUBBLE, /// Bubble chart. TYPEID_SURFACE, /// Surface chart. + TYPEID_FUNNEL, /// Funnel chart. TYPEID_HISTO, /// Histogram chart. TYPEID_UNKNOWN, /// Default for unknown chart types. }; @@ -62,7 +63,8 @@ enum TypeCategory TYPECATEGORY_PIE, /// Pie and donut charts. TYPECATEGORY_SCATTER, /// Scatter and bubble charts. TYPECATEGORY_SURFACE, /// Surface charts. - TYPECATEGORY_HISTO /// Histogram charts. + TYPECATEGORY_FUNNEL, /// Funnel charts. TODO: can this be BAR? + TYPECATEGORY_HISTO, /// Histogram charts. }; /** Enumerates modes for varying point colors in a series. */ diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx index 5eb725204125..a8b34ba8e92e 100644 --- a/oox/source/core/contexthandler2.cxx +++ b/oox/source/core/contexthandler2.cxx @@ -242,7 +242,8 @@ bool ContextHandler2Helper::prepareMceContext( sal_Int32 nElement, const Attribu u"p14", u"p15", u"x12ac", - u"v" + u"v", + u"cx2" }; for (size_t pos = 0; pos != std::u16string_view::npos;) diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 63048c654fcd..daf4ce7cd281 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -154,7 +154,7 @@ const Sequence< beans::Pair< OUString, sal_Int32 > >& NamespaceIds() NMSP_xr16}, {u"http://schemas.microsoft.com/office/drawing/2017/decorative"_ustr, NMSP_adec}, {u"http://schemas.microsoft.com/office/drawing/2016/SVG/main"_ustr, NMSP_asvg}, - {u"http://schemas.microsoft.com/office/drawing/2014/chartex"_ustr, NMSP_chartex}, + {u"http://schemas.microsoft.com/office/drawing/2014/chartex"_ustr, NMSP_cx}, }; return SINGLETON; }; diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx b/oox/source/drawingml/chart/chartspacefragment.cxx index f43908d65cb5..538631ee63ca 100644 --- a/oox/source/drawingml/chart/chartspacefragment.cxx +++ b/oox/source/drawingml/chart/chartspacefragment.cxx @@ -51,6 +51,8 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const { case C_TOKEN( chartSpace ): return this; + case CX_TOKEN(chartSpace) : + break; } break; @@ -134,6 +136,8 @@ ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const return new View3DContext( *this, mrModel.mxView3D.create(bMSO2007Document) ); } break; + case CX_TOKEN(chartSpace) : + break; } return nullptr; } diff --git a/oox/source/drawingml/chart/plotareacontext.cxx b/oox/source/drawingml/chart/plotareacontext.cxx index 1004cdafb045..7ffa7c81eed0 100644 --- a/oox/source/drawingml/chart/plotareacontext.cxx +++ b/oox/source/drawingml/chart/plotareacontext.cxx @@ -165,6 +165,10 @@ ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const At return new ShapePropertiesContext( *this, mrModel.mxShapeProp.getOrCreate() ); case C_TOKEN(dTable): return new DataTableContext( *this, mrModel.mxDataTable.create() ); +#if 0 + case CHARTEX_TOKEN( funnel ): + return new FunnelTypeGroupContext( *this, mrModel.maTypeGroups.create( nElement, false ) ); +#endif } break; } diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index 71be134a9f03..15711e156cc2 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -67,6 +67,7 @@ const char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType"; const char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType"; const char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType"; const char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo +const char SERVICE_CHART2_FUNNEL[] = "com.sun.star.chart2.FunnelChartType"; const char SERVICE_CHART2_HISTO[] = "com.sun.star.chart2.HistogramChartType"; namespace csscd = css::chart::DataLabelPlacement; @@ -87,7 +88,8 @@ const TypeGroupInfo spTypeInfos[] = { TYPEID_OFPIE, TYPECATEGORY_PIE, SERVICE_CHART2_PIE, VARPOINTMODE_MULTI, csscd::AVOID_OVERLAP, true, true, true, true, false, false, false }, { TYPEID_SCATTER, TYPECATEGORY_SCATTER, SERVICE_CHART2_SCATTER, VARPOINTMODE_SINGLE, csscd::RIGHT, false, false, false, false, false, false, false }, { TYPEID_BUBBLE, TYPECATEGORY_SCATTER, SERVICE_CHART2_BUBBLE, VARPOINTMODE_SINGLE, csscd::RIGHT, false, true, false, false, false, false, false }, - { TYPEID_SURFACE, TYPECATEGORY_SURFACE, SERVICE_CHART2_SURFACE, VARPOINTMODE_NONE, csscd::RIGHT, false, true, false, true, false, false, false } + { TYPEID_SURFACE, TYPECATEGORY_SURFACE, SERVICE_CHART2_SURFACE, VARPOINTMODE_NONE, csscd::RIGHT, false, true, false, true, false, false, false }, + { TYPEID_FUNNEL, TYPECATEGORY_FUNNEL, SERVICE_CHART2_FUNNEL, VARPOINTMODE_SINGLE, csscd::OUTSIDE, false, true, false, true, false, false, false } }; const TypeGroupInfo saUnknownTypeInfo = @@ -155,6 +157,7 @@ TypeGroupConverter::TypeGroupConverter( const ConverterRoot& rParent, TypeGroupM case C_TOKEN( barChart ): ENSURE_AXESCOUNT( 2, 2 ); eTypeId = TYPEID_BAR; mb3dChart = false; break; case C_TOKEN( bubbleChart ): ENSURE_AXESCOUNT( 2, 2 ); eTypeId = TYPEID_BUBBLE; mb3dChart = false; break; case C_TOKEN( doughnutChart ): ENSURE_AXESCOUNT( 0, 0 ); eTypeId = TYPEID_DOUGHNUT; mb3dChart = false; break; + case CX_TOKEN( funnel ): ENSURE_AXESCOUNT( 2, 2 ); eTypeId = TYPEID_FUNNEL; mb3dChart = false; break; case C_TOKEN( line3DChart ): ENSURE_AXESCOUNT( 3, 3 ); eTypeId = TYPEID_LINE; mb3dChart = true; break; case C_TOKEN( lineChart ): ENSURE_AXESCOUNT( 2, 2 ); eTypeId = TYPEID_LINE; mb3dChart = false; break; case C_TOKEN( ofPieChart ): ENSURE_AXESCOUNT( 0, 0 ); eTypeId = TYPEID_OFPIE; mb3dChart = false; break; diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 9acdc6b54e16..4753eb9e3b19 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -161,6 +161,10 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/chart" || sUri == "http://purl.oclc.org/ooxml/drawingml/chart" ) return new ChartGraphicDataContext( *this, mpShapePtr, mbEmbedShapesInChart ); + else if ( sUri == "http://schemas.microsoft.com/office/drawing/2014/chartex" ) + // Is there a corresponding purl.oclc.org URL? At this time + // (2025) those don't seem to be active. + return new ChartGraphicDataContext( *this, mpShapePtr, mbEmbedShapesInChart ); else if ( sUri == "http://schemas.openxmlformats.org/drawingml/2006/table" || sUri == "http://purl.oclc.org/ooxml/drawingml/table" ) return new table::TableContext( *this, mpShapePtr ); @@ -326,7 +330,7 @@ ChartGraphicDataContext::ChartGraphicDataContext( ContextHandler2Helper const & ContextHandlerRef ChartGraphicDataContext::onCreateContext( ::sal_Int32 nElement, const AttributeList& rAttribs ) { - if( nElement == C_TOKEN( chart ) ) + if( nElement == C_TOKEN( chart ) || nElement == CX_TOKEN( chart )) { mrChartShapeInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getStringDefaulted( R_TOKEN( id )) ); } diff --git a/oox/source/token/namespaces-strict.txt b/oox/source/token/namespaces-strict.txt index 36261d0707eb..84178d87f871 100644 --- a/oox/source/token/namespaces-strict.txt +++ b/oox/source/token/namespaces-strict.txt @@ -95,7 +95,7 @@ xr16 http://schemas.microsoft.com/office/spreadsheetml/2017/r # MSO 2014 extensions --------------------------------------------------------- -chartex http://schemas.microsoft.com/office/drawing/2014/chartex +cx http://schemas.microsoft.com/office/drawing/2014/chartex # extlst namespaces diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index 7d7012c9690e..0f431907b862 100644 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -65,7 +65,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } #define XR2_TOKEN(token) OOX_TOKEN(xr2, token) #define XR16_TOKEN(token) OOX_TOKEN(xr16, token) #define WPC_TOKEN(token) OOX_TOKEN(wpc, token) -#define CHARTEX_TOKEN(token) OOX_TOKEN(chartex, token) +#define CX_TOKEN(token) OOX_TOKEN(cx, token) } // namespace oox diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index 32c5ffdead1b..7313451b9787 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -94,7 +94,7 @@ xr16 http://schemas.microsoft.com/office/spreadsheetml/2017/r # MSO 2014 extensions --------------------------------------------------------- -chartex http://schemas.microsoft.com/office/drawing/2014/chartex +cx http://schemas.microsoft.com/office/drawing/2014/chartex # extlst namespaces