Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2671
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/71/2671/1
Resolves: #119989# Support relative 3D pie chart height when importing charts.
Reported by: Yan Li
Patch by: Yan Li, Tan Li, alg
Review by: alg(cherry picked from commit 2b1cedbe547ea8f7979f91873dd6e602ebb08a7b)
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
(cherry picked from commit ded39ea57b25617071012640cbaebaaf72a05744)
Change-Id: Ibc6f070021c79809c651ba789409a5fb5096c185
---
M chart2/source/model/main/Diagram.cxx
M chart2/source/model/template/PieChartType.cxx
M chart2/source/view/charttypes/PieChart.cxx
M chart2/source/view/main/ChartView.cxx
M sc/source/filter/excel/xichart.cxx
M sc/source/filter/inc/xlchart.hxx
6 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 1cca41c..1756c822 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -73,7 +73,8 @@
PROP_DIAGRAM_PERSPECTIVE,
PROP_DIAGRAM_ROTATION_HORIZONTAL,
PROP_DIAGRAM_ROTATION_VERTICAL,
- PROP_DIAGRAM_MISSING_VALUE_TREATMENT
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+ PROP_DIAGRAM_3DRELATIVEHEIGHT
};
void lcl_AddPropertiesToVector(
@@ -166,6 +167,11 @@
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U("3DRelativeHeight"),
+ PROP_DIAGRAM_3DRELATIVEHEIGHT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
}
struct StaticDiagramDefaults_Initializer
@@ -186,7 +192,8 @@
::chart::PropertyHelper::setPropertyValueDefault( rOutMap,
PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES,
false );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap,
PROP_DIAGRAM_STARTING_ANGLE, 90 );
- ::chart::SceneProperties::AddDefaultsToMap( rOutMap );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap,
PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
+ ::chart::SceneProperties::AddDefaultsToMap( rOutMap );
}
};
diff --git a/chart2/source/model/template/PieChartType.cxx
b/chart2/source/model/template/PieChartType.cxx
index 450a622..05b8219 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -42,7 +42,8 @@
enum
{
- PROP_PIECHARTTYPE_USE_RINGS
+ PROP_PIECHARTTYPE_USE_RINGS,
+ PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
};
static void lcl_AddPropertiesToVector(
@@ -54,6 +55,11 @@
::getBooleanCppuType(),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U("3DRelativeHeight"),
+ PROP_PIECHARTTYPE_3DRELATIVEHEIGHT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
}
struct StaticPieChartTypeDefaults_Initializer
@@ -68,6 +74,7 @@
void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
{
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS,
false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap,
PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 );
}
};
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index e8fc689..bb68948 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -340,6 +340,17 @@
m_aLabelInfoList.clear();
::rtl::math::setNan(&m_fMaxOffset);
+ sal_Int32 n3DRelativeHeight = 100;
+ uno::Reference< beans::XPropertySet > xPropertySet( m_xChartTypeModel, uno::UNO_QUERY );
+ if ( (m_nDimension==3) && xPropertySet.is())
+ {
+ try
+ {
+ uno::Any aAny = xPropertySet->getPropertyValue( C2U("3DRelativeHeight") );
+ aAny >>= n3DRelativeHeight;
+ }
+ catch(const uno::Exception& e) {}
+ }
//=============================================================================
for( double fSlotX=0; aXSlotIter != aXSlotEnd && (m_bUseRings||fSlotX<0.5 ); ++aXSlotIter,
fSlotX+=1.0 )
@@ -380,7 +391,8 @@
if( !bIsVisible )
continue;
- double fDepth = this->getTransformedDepth();
+ double fLogicZ = -1.0;//as defined
+ double fDepth = this->getTransformedDepth() * (n3DRelativeHeight / 100.0);
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes =
getSeriesGroupShape(pSeries, xSeriesTarget);
//collect data point information (logic coordinates, style ):
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index f2ace4a..82ca2d9 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -102,6 +102,7 @@
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <svl/languageoptions.hxx>
#include <sot/clsids.hxx>
+#include "servicenames_charttypes.hxx"
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
@@ -621,6 +622,7 @@
sal_Bool bGroupBarsPerAxis = sal_True;
sal_Bool bIncludeHiddenCells = sal_True;
sal_Int32 nStartingAngle = 90;
+ sal_Int32 n3DRelativeHeight = 100;
try
{
uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
@@ -629,6 +631,11 @@
xDiaProp->getPropertyValue( C2U( "GroupBarsPerAxis" ) ) >>= bGroupBarsPerAxis;
xDiaProp->getPropertyValue( C2U( "IncludeHiddenCells" ) ) >>= bIncludeHiddenCells;
xDiaProp->getPropertyValue( C2U( "StartingAngle" ) ) >>= nStartingAngle;
+
+ if (nDimensionCount == 3)
+ {
+ xDiaProp->getPropertyValue( C2U( "3DRelativeHeight" ) ) >>= n3DRelativeHeight;
+ }
}
catch( const uno::Exception & ex )
{
@@ -663,6 +670,22 @@
for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
{
uno::Reference< XChartType > xChartType( aChartTypeList[nT] );
+ if(3 == nDimensionCount &&
xChartType->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE))
+ {
+ uno::Reference< beans::XPropertySet > xPropertySet( xChartType, uno::UNO_QUERY );
+ if (xPropertySet.is())
+ {
+ try
+ {
+ sal_Int32 n3DRelativeHeightOldValue(100);
+ uno::Any aAny = xPropertySet->getPropertyValue( C2U("3DRelativeHeight") );
+ aAny >>= n3DRelativeHeightOldValue;
+ if (n3DRelativeHeightOldValue != n3DRelativeHeight)
+ xPropertySet->setPropertyValue( C2U("3DRelativeHeight"),
uno::makeAny(n3DRelativeHeight) );
+ }
+ catch(const uno::Exception& e){}
+ }
+ }
if(nT==0)
m_bChartTypeUsesShiftedCategoryPositionPerDefault =
ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( xChartType );
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 8310deb..f945a89 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2452,6 +2452,7 @@
}
// properties
+ rPropSet.SetProperty( EXC_CHPROP_3DRELATIVEHEIGHT, (sal_Int32)(maData.mnRelHeight / 2)); //
seems to be 200%, cange to 100%
rPropSet.SetProperty( EXC_CHPROP_ROTATIONVERTICAL, nRotationY );
rPropSet.SetProperty( EXC_CHPROP_ROTATIONHORIZONTAL, nRotationX );
rPropSet.SetProperty( EXC_CHPROP_PERSPECTIVE, nPerspective );
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index 97d3a32..fc74ff8 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -80,6 +80,7 @@
#define EXC_CHPROP_CROSSOVERPOSITION "CrossoverPosition"
#define EXC_CHPROP_CROSSOVERVALUE "CrossoverValue"
#define EXC_CHPROP_CURVESTYLE "CurveStyle"
+#define EXC_CHPROP_D3DCAMERAGEOMETRY "D3DCameraGeometry"
#define EXC_CHPROP_D3DSCENEAMBIENTCOLOR "D3DSceneAmbientColor"
#define EXC_CHPROP_D3DSCENELIGHTON1 "D3DSceneLightOn1"
#define EXC_CHPROP_D3DSCENELIGHTCOLOR2 "D3DSceneLightColor2"
@@ -87,14 +88,18 @@
#define EXC_CHPROP_D3DSCENELIGHTON2 "D3DSceneLightOn2"
#define EXC_CHPROP_D3DSCENEPERSPECTIVE "D3DScenePerspective"
#define EXC_CHPROP_D3DSCENESHADEMODE "D3DSceneShadeMode"
+#define EXC_CHPROP_D3DTRANSFORMMATRIX "D3DTransformMatrix"
#define EXC_CHPROP_DISPLAYLABELS "DisplayLabels"
#define EXC_CHPROP_ERRORBARSTYLE "ErrorBarStyle"
#define EXC_CHPROP_ERRORBARX "ErrorBarX"
#define EXC_CHPROP_ERRORBARY "ErrorBarY"
#define EXC_CHPROP_EXPANSION "Expansion"
#define EXC_CHPROP_EXPTIMEINCREMENT "ExplicitTimeIncrement"
+#define EXC_CHPROP_FILLBITMAPMODE "FillBitmapMode"
+#define EXC_CHPROP_FILLSTYLE "FillStyle"
#define EXC_CHPROP_GAPWIDTHSEQ "GapwidthSequence"
#define EXC_CHPROP_GEOMETRY3D "Geometry3D"
+#define EXC_CHPROP_HASMAINTITLE "HasMainTitle"
#define EXC_CHPROP_INCLUDEHIDDENCELLS "IncludeHiddenCells"
#define EXC_CHPROP_JAPANESE "Japanese"
#define EXC_CHPROP_LABEL "Label"
@@ -119,6 +124,7 @@
#define EXC_CHPROP_ROLE "Role"
#define EXC_CHPROP_ROTATIONHORIZONTAL "RotationHorizontal"
#define EXC_CHPROP_ROTATIONVERTICAL "RotationVertical"
+#define EXC_CHPROP_3DRELATIVEHEIGHT "3DRelativeHeight"
#define EXC_CHPROP_SHOW "Show"
#define EXC_CHPROP_SHOWCORRELATION "ShowCorrelationCoefficient"
#define EXC_CHPROP_SHOWEQUATION "ShowEquation"
--
To view, visit https://gerrit.libreoffice.org/2671
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc6f070021c79809c651ba789409a5fb5096c185
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Fridrich Strba <fridrich@documentfoundation.org>
Context
- [PATCH libreoffice-4-0] Resolves: #119989# Support relative 3D pie chart height when... · Fridrich Strba (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.