[Libreoffice-commits] core.git: chart2/source sc/source

Armin Le Grand alg at apache.org
Mon Mar 11 09:47:05 PDT 2013


 chart2/source/model/main/Diagram.cxx          |   11 +++++++++--
 chart2/source/model/template/PieChartType.cxx |    9 ++++++++-
 chart2/source/view/charttypes/PieChart.cxx    |   14 +++++++++++++-
 chart2/source/view/main/ChartView.cxx         |   23 +++++++++++++++++++++++
 sc/source/filter/excel/xichart.cxx            |    1 +
 sc/source/filter/inc/xlchart.hxx              |    6 ++++++
 6 files changed, 60 insertions(+), 4 deletions(-)

New commits:
commit ded39ea57b25617071012640cbaebaaf72a05744
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Jun 28 10:01:49 2012 +0000

     #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 at bluewin.ch>
    
    Conflicts:
    	chart2/source/view/charttypes/PieChart.cxx
    	chart2/source/view/main/ChartView.cxx
    	sc/source/filter/inc/xlchart.hxx
    
    Change-Id: Ibc6f070021c79809c651ba789409a5fb5096c185

diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 75c97e1..810da642 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -73,7 +73,8 @@ enum
     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 @@ void lcl_AddPropertiesToVector(
                   ::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 @@ private:
         ::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 41e44fa..5bef973 100644
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -42,7 +42,8 @@ namespace
 
 enum
 {
-    PROP_PIECHARTTYPE_USE_RINGS
+    PROP_PIECHARTTYPE_USE_RINGS,
+    PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
 };
 
 static void lcl_AddPropertiesToVector(
@@ -54,6 +55,11 @@ static void lcl_AddPropertiesToVector(
                   ::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 @@ private:
     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 b5c307a..b532c20 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -340,6 +340,17 @@ void PieChart::createShapes()
 
     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 @@ void PieChart::createShapes()
             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 feeb6e6..70612e0 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 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
     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 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
         xDiaProp->getPropertyValue( "GroupBarsPerAxis" ) >>= bGroupBarsPerAxis;
         xDiaProp->getPropertyValue( "IncludeHiddenCells" ) >>= bIncludeHiddenCells;
         xDiaProp->getPropertyValue( "StartingAngle" ) >>= nStartingAngle;
+
+        if (nDimensionCount == 3)
+        {
+             xDiaProp->getPropertyValue( "3DRelativeHeight" ) >>= n3DRelativeHeight;
+        }
     }
     catch( const uno::Exception & ex )
     {
@@ -663,6 +670,22 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
         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 f2321bf..aa8d576 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2454,6 +2454,7 @@ void XclImpChChart3d::Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) con
     }
 
     // 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 1605f8a..6afb2ed 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -79,6 +79,7 @@ class XclRoot;
 #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"
@@ -86,14 +87,18 @@ class XclRoot;
 #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"
@@ -118,6 +123,7 @@ class XclRoot;
 #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"


More information about the Libreoffice-commits mailing list