summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorKurt Nordback <kurt.nordback@protonmail.com>2024-02-03 09:40:44 -0700
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-02-06 15:16:31 +0100
commit15633d637e6296df218d56130d041660bf0e8317 (patch)
tree9253af3eb9b87c06253749f78cb9b1857371065a /chart2/source
parent23293fc6a7c811d624d6d4589195b3d971448890 (diff)
tdf#50934: Add a version comment, and more structure for of-pie
Change-Id: I9d7c25e47a3f4a78360f9b2deffe8650e378866d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156305 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx2
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx6
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx17
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx15
-rw-r--r--chart2/source/view/charttypes/PieChart.hxx2
5 files changed, 33 insertions, 9 deletions
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index e0ddd62cd6ed..7d791815e70f 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -78,7 +78,7 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle
m_xSubTypeList->SetStyle(m_xSubTypeList->GetStyle() |
WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
- m_xSubTypeList->SetColCount(4);
+ m_xSubTypeList->SetColCount(6);
m_xSubTypeList->SetLineCount(1);
bool bEnableComplexChartTypes = true;
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index accf2078c2a6..2e6753444d99 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -405,13 +405,11 @@ rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate(
break;
case TEMPLATE_BAROFPIE:
xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, true,
- chart2::PieChartSubType_BAR ));
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_BAR ));
break;
case TEMPLATE_PIEOFPIE:
xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
- chart2::PieChartOffsetMode_ALL_EXPLODED, true,
- chart2::PieChartSubType_PIE ));
+ chart2::PieChartOffsetMode_NONE, false, chart2::PieChartSubType_PIE ));
break;
case TEMPLATE_THREEDPIE:
xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier,
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 2f8c7fb7705f..322b75243fb9 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -266,6 +266,8 @@ void PieChartTypeTemplate::createChartTypes(
rtl::Reference< ChartType > xCT = new PieChartType();
xCT->setFastPropertyValue(
PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings"
+ xCT->setFastPropertyValue(
+ PROP_PIECHARTTYPE_SUBTYPE, getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE )); // "SubType"
rCoordSys[0]->setChartTypes( std::vector{xCT} );
if( !aSeriesSeq.empty() )
@@ -294,10 +296,8 @@ bool PieChartTypeTemplate::matchesTemplate2(
getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings;
chart2::PieChartOffsetMode ePieOffsetMode;
getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
- /*
- chart2::PieChartSubType ePieSubType;
- getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ) >>= ePieSubType;
- */
+ chart2::PieChartSubType eTemplateSubType;
+ getFastPropertyValue( PROP_PIE_TEMPLATE_SUB_PIE_TYPE ) >>= eTemplateSubType;
//check offset-mode
if( bResult )
@@ -372,6 +372,15 @@ bool PieChartTypeTemplate::matchesTemplate2(
bResult = ( bTemplateUsesRings == bUseRings );
}
}
+ if( bResult )
+ {
+ rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 );
+ chart2::PieChartSubType eSubType = chart2::PieChartSubType_NONE;
+ if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_SUBTYPE ) >>= eSubType )
+ {
+ bResult = ( eTemplateSubType == eSubType );
+ }
+ }
return bResult;
}
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index d97324288416..7aeb18d2f6e3 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -185,6 +185,7 @@ PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel
, m_aPosHelper( (m_nDimension==3) ? 0.0 : 90.0 )
, m_bUseRings(false)
, m_bSizeExcludesLabelsAndExplodedSegments(bExcludingPositioning)
+ , m_eSubType(PieChartSubType_NONE)
, m_fMaxOffset(std::numeric_limits<double>::quiet_NaN())
{
PlotterBase::m_pPosHelper = &m_aPosHelper;
@@ -209,6 +210,14 @@ PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel
{
TOOLS_WARN_EXCEPTION("chart2", "" );
}
+ try
+ {
+ xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_SUBTYPE) >>= m_eSubType; // "SubType"
+ }
+ catch( const uno::Exception& )
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "" );
+ }
}
PieChart::~PieChart()
@@ -277,8 +286,14 @@ rtl::Reference<SvxShape> PieChart::createDataPoint(
drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(fAngle, fRadius, rParam.mfLogicZ);
aOffset = aNewOrigin - aOrigin;
}
+ } else if (m_eSubType != PieChartSubType_NONE) {
+ drawing::Position3D aOrigin = m_aPosHelper.transformUnitCircleToScene(0, 0, rParam.mfLogicZ);
+ drawing::Position3D aNewOrigin = m_aPosHelper.transformUnitCircleToScene(180, 1.0, rParam.mfLogicZ);
+ aOffset = aNewOrigin - aOrigin;
+ fExplodedOuterRadius *= 2.0/3;
}
+
//create point
rtl::Reference<SvxShape> xShape;
if(m_nDimension==3)
diff --git a/chart2/source/view/charttypes/PieChart.hxx b/chart2/source/view/charttypes/PieChart.hxx
index 5caacd4db9b3..d6792f0b8479 100644
--- a/chart2/source/view/charttypes/PieChart.hxx
+++ b/chart2/source/view/charttypes/PieChart.hxx
@@ -24,6 +24,7 @@
#include <PlottingPositionHelper.hxx>
#include <basegfx/vector/b2ivector.hxx>
#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/chart2/PieChartSubType.hpp>
namespace chart
{
@@ -125,6 +126,7 @@ private: //member
PiePositionHelper m_aPosHelper;
bool m_bUseRings;
bool m_bSizeExcludesLabelsAndExplodedSegments;
+ ::css::chart2::PieChartSubType m_eSubType;
struct PieLabelInfo
{