incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1354914 - in /incubator/ooo/trunk/main: chart2/source/model/main/ chart2/source/model/template/ chart2/source/view/charttypes/ chart2/source/view/main/ sc/source/filter/excel/ sc/source/filter/inc/
Date Thu, 28 Jun 2012 11:01:51 GMT
Author: alg
Date: Thu Jun 28 11:01:49 2012
New Revision: 1354914

URL: http://svn.apache.org/viewvc?rev=1354914&view=rev
Log:
#119989# Support relative 3D pie chart height when importing charts.
Reported by: Yan Li
Patch by: Yan Li, Tan Li, alg
Review by: alg

Modified:
    incubator/ooo/trunk/main/chart2/source/model/main/Diagram.cxx
    incubator/ooo/trunk/main/chart2/source/model/template/PieChartType.cxx
    incubator/ooo/trunk/main/chart2/source/view/charttypes/PieChart.cxx
    incubator/ooo/trunk/main/chart2/source/view/main/ChartView.cxx
    incubator/ooo/trunk/main/sc/source/filter/excel/xichart.cxx
    incubator/ooo/trunk/main/sc/source/filter/inc/xlchart.hxx

Modified: incubator/ooo/trunk/main/chart2/source/model/main/Diagram.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/model/main/Diagram.cxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/model/main/Diagram.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/model/main/Diagram.cxx Thu Jun 28 11:01:49 2012
@@ -79,7 +79,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(
@@ -172,6 +173,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
@@ -192,7 +198,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 );
     }    
 };
 

Modified: incubator/ooo/trunk/main/chart2/source/model/template/PieChartType.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/model/template/PieChartType.cxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/model/template/PieChartType.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/model/template/PieChartType.cxx Thu Jun 28 11:01:49
2012
@@ -49,7 +49,8 @@ namespace
 
 enum
 {
-    PROP_PIECHARTTYPE_USE_RINGS
+    PROP_PIECHARTTYPE_USE_RINGS,
+    PROP_PIECHARTTYPE_3DRELATIVEHEIGHT
 };
 
 void lcl_AddPropertiesToVector(
@@ -61,6 +62,11 @@ 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
@@ -75,6 +81,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 );
     }    
 };
 

Modified: incubator/ooo/trunk/main/chart2/source/view/charttypes/PieChart.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/view/charttypes/PieChart.cxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/view/charttypes/PieChart.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/view/charttypes/PieChart.cxx Thu Jun 28 11:01:49
2012
@@ -365,6 +365,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 )
@@ -406,7 +417,7 @@ void PieChart::createShapes()
                 continue;
 
             double fLogicZ = -1.0;//as defined
-            double fDepth  = this->getTransformedDepth();
+            double fDepth  = this->getTransformedDepth() * (n3DRelativeHeight / 100.0);
 //=============================================================================
 
             uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries,
xSeriesTarget);

Modified: incubator/ooo/trunk/main/chart2/source/view/main/ChartView.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/chart2/source/view/main/ChartView.cxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/chart2/source/view/main/ChartView.cxx (original)
+++ incubator/ooo/trunk/main/chart2/source/view/main/ChartView.cxx Thu Jun 28 11:01:49 2012
@@ -102,6 +102,7 @@
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <svl/languageoptions.hxx>
 #include <sot/clsids.hxx>
+#include "servicenames_charttypes.hxx"
 
 //.............................................................................
 namespace chart
@@ -642,6 +643,7 @@ void SeriesPlotterContainer::initializeC
     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
);
@@ -650,6 +652,11 @@ void SeriesPlotterContainer::initializeC
         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 )
     {
@@ -684,6 +691,22 @@ void SeriesPlotterContainer::initializeC
         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 );

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xichart.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xichart.cxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xichart.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xichart.cxx Thu Jun 28 11:01:49 2012
@@ -2401,6 +2401,7 @@ void XclImpChChart3d::Convert( ScfProper
     }
 
     // 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 );

Modified: incubator/ooo/trunk/main/sc/source/filter/inc/xlchart.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/inc/xlchart.hxx?rev=1354914&r1=1354913&r2=1354914&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/inc/xlchart.hxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/inc/xlchart.hxx Thu Jun 28 11:01:49 2012
@@ -127,6 +127,7 @@ class XclRoot;
 #define EXC_CHPROP_ROLE                     CREATE_OUSTRING( "Role" )
 #define EXC_CHPROP_ROTATIONHORIZONTAL       CREATE_OUSTRING( "RotationHorizontal" )
 #define EXC_CHPROP_ROTATIONVERTICAL         CREATE_OUSTRING( "RotationVertical" )
+#define EXC_CHPROP_3DRELATIVEHEIGHT         CREATE_OUSTRING( "3DRelativeHeight" )
 #define EXC_CHPROP_SHOW                     CREATE_OUSTRING( "Show" )
 #define EXC_CHPROP_SHOWCORRELATION          CREATE_OUSTRING( "ShowCorrelationCoefficient"
)
 #define EXC_CHPROP_SHOWEQUATION             CREATE_OUSTRING( "ShowEquation" )



Mime
View raw message