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

Kohei Yoshida kohei.yoshida at gmail.com
Tue Sep 3 17:10:34 PDT 2013


 chart2/source/view/diagram/VDiagram.cxx |   24 ++++++++++--------------
 chart2/source/view/inc/VDiagram.hxx     |   12 ++++--------
 chart2/source/view/main/ChartView.cxx   |    2 +-
 3 files changed, 15 insertions(+), 23 deletions(-)

New commits:
commit 8cdea5e1028edff0b5b16186f31dadcc32aa2d19
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Sep 3 20:07:50 2013 -0400

    No point having two separate drawing targets - final target not used.
    
    Let's just keep one target m_xTarget.
    
    Change-Id: Ic9b14179a44371bbc667bd5d851b5d3d8d331eb3

diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index c8efd6a..92b7162 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -51,8 +51,7 @@ VDiagram::VDiagram(
     const uno::Reference< XDiagram > & xDiagram
     , const drawing::Direction3D& rPreferredAspectRatio
     , sal_Int32 nDimension, sal_Bool bPolar )
-    : m_xLogicTarget(NULL)
-    , m_xFinalTarget(NULL)
+    : m_xTarget(NULL)
     , m_xShapeFactory(NULL)
     , m_pShapeFactory(NULL)
     , m_xOuterGroupShape(NULL)
@@ -92,14 +91,11 @@ VDiagram::~VDiagram()
 }
 
 void VDiagram::init(
-                const uno::Reference< drawing::XShapes >& xLogicTarget
-              , const uno::Reference< drawing::XShapes >& xFinalTarget
-              , const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+    const uno::Reference< drawing::XShapes >& xTarget, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
 {
-    OSL_PRECOND(xLogicTarget.is()&&xFinalTarget.is()&&xFactory.is(),"no proper initialization parameters");
+    OSL_PRECOND(xLogicTarget.is() && xFactory.is(), "no proper initialization parameters");
 
-    m_xLogicTarget  = xLogicTarget;
-    m_xFinalTarget  = xFinalTarget;
+    m_xTarget  = xTarget;
     m_xShapeFactory = xFactory;
     m_pShapeFactory = new ShapeFactory(xFactory);
 }
@@ -157,12 +153,12 @@ void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize )
 
 void VDiagram::createShapes_2d()
 {
-    OSL_PRECOND(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is(),"is not proper initialized");
-    if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is()))
+    OSL_PRECOND(m_pShapeFactory && m_xTarget.is() && m_xShapeFactory.is(), "is not proper initialized");
+    if (!m_pShapeFactory || !m_xTarget.is() || !m_xShapeFactory.is())
         return;
 
     //create group shape
-    uno::Reference< drawing::XShapes > xOuterGroup_Shapes = m_pShapeFactory->createGroup2D(m_xLogicTarget);
+    uno::Reference< drawing::XShapes > xOuterGroup_Shapes = m_pShapeFactory->createGroup2D(m_xTarget);
     m_xOuterGroupShape = uno::Reference<drawing::XShape>( xOuterGroup_Shapes, uno::UNO_QUERY );
 
     uno::Reference< drawing::XShapes > xGroupForWall( m_pShapeFactory->createGroup2D(xOuterGroup_Shapes,"PlotAreaExcludingAxes") );
@@ -478,8 +474,8 @@ void VDiagram::adjustAspectRatio3d( const awt::Size& rAvailableSize )
 
 void VDiagram::createShapes_3d()
 {
-    OSL_PRECOND(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is(),"is not proper initialized");
-    if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()&&m_xShapeFactory.is()))
+    OSL_PRECOND(m_pShapeFactory && m_xTarget.is() && m_xShapeFactory.is(), "is not proper initialized");
+    if (!m_pShapeFactory || !m_xTarget.is() || !m_xShapeFactory.is())
         return;
 
     //create shape
@@ -487,7 +483,7 @@ void VDiagram::createShapes_3d()
             m_xShapeFactory->createInstance(
             "com.sun.star.drawing.Shape3DSceneObject" ), uno::UNO_QUERY );
     ShapeFactory::setShapeName( m_xOuterGroupShape, "PlotAreaExcludingAxes" );
-    m_xLogicTarget->add(m_xOuterGroupShape);
+    m_xTarget->add(m_xOuterGroupShape);
 
     uno::Reference< drawing::XShapes > xOuterGroup_Shapes =
             uno::Reference<drawing::XShapes>( m_xOuterGroupShape, uno::UNO_QUERY );
diff --git a/chart2/source/view/inc/VDiagram.hxx b/chart2/source/view/inc/VDiagram.hxx
index cc4603b..5659354 100644
--- a/chart2/source/view/inc/VDiagram.hxx
+++ b/chart2/source/view/inc/VDiagram.hxx
@@ -45,11 +45,9 @@ public: //methods
                 , sal_Int32 nDimension=3, sal_Bool bPolar=sal_False );
     virtual ~VDiagram();
 
-    void init( const ::com::sun::star::uno::Reference<
-                     ::com::sun::star::drawing::XShapes >& xLogicTarget
-             , const ::com::sun::star::uno::Reference<
-                     ::com::sun::star::drawing::XShapes >& xFinalTarget
-             , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory);
+    void init(
+        const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>& xTarget,
+        const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xFactory );
 
     void    createShapes( const ::com::sun::star::awt::Point& rPos
                         , const ::com::sun::star::awt::Size& rSize );
@@ -81,9 +79,7 @@ private: //members
     VDiagram(const VDiagram& rD);
 
     ::com::sun::star::uno::Reference<
-                    ::com::sun::star::drawing::XShapes >                    m_xLogicTarget;
-    ::com::sun::star::uno::Reference<
-                    ::com::sun::star::drawing::XShapes >                    m_xFinalTarget;
+                    ::com::sun::star::drawing::XShapes >                    m_xTarget;
     ::com::sun::star::uno::Reference<
                     ::com::sun::star::lang::XMultiServiceFactory>           m_xShapeFactory;
     ShapeFactory*                                                           m_pShapeFactory;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 5dda2a2..1332ce4 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1396,7 +1396,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
     VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
     bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram);
     {//create diagram
-        aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory);
+        aVDiagram.init(xDiagramPlusAxes_Shapes, m_xShapeFactory);
         aVDiagram.createShapes(rAvailablePos,rAvailableSize);
         xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
         // It is preferrable to use full size than minimum for pie charts


More information about the Libreoffice-commits mailing list