[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 4 commits - chart2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 7 21:09:35 PST 2012


 chart2/source/controller/dialogs/res_DataLabel.cxx           |    9 ++-
 chart2/source/controller/main/ChartController_Properties.cxx |    2 
 chart2/source/controller/main/DragMethod_RotateDiagram.cxx   |    3 -
 chart2/source/inc/defines.hxx                                |   27 +++++++++++
 chart2/source/tools/ThreeDHelper.cxx                         |    4 -
 chart2/source/view/axes/VCoordinateSystem.cxx                |    1 
 chart2/source/view/charttypes/PieChart.cxx                   |   10 +++-
 chart2/source/view/charttypes/VSeriesPlotter.cxx             |    1 
 chart2/source/view/diagram/VDiagram.cxx                      |    1 
 chart2/source/view/inc/ViewDefines.hxx                       |    5 --
 chart2/source/view/main/ChartView.cxx                        |    1 
 chart2/source/view/main/PlottingPositionHelper.cxx           |    1 
 12 files changed, 51 insertions(+), 14 deletions(-)

New commits:
commit 7061f72159e38e76134bc7fefc8a75cd233889cf
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Sat Dec 8 00:00:49 2012 -0500

    bnc#791952: Setting properties for all data labels.
    
    You can set different properties to individual data labels.  But setting
    new properties to all data labels should overwrite the individual settings.
    
    Change-Id: I934bad89326115aa83feb86275cf380d701a5686

diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index 9113d90..a651eb8 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -282,14 +282,15 @@ void DataLabelResources::EnableControls()
 {
     m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
 
-    //enable separator
+    // Enable or disable separator, placement and direction based on the check
+    // box states. Note that the check boxes are tri-state.
     {
         long nNumberOfCheckedLabelParts = 0;
-        if( m_aCBNumber.IsChecked() )
+        if (m_aCBNumber.GetState() != STATE_NOCHECK)
             ++nNumberOfCheckedLabelParts;
-        if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
+        if (m_aCBPercent.GetState() != STATE_NOCHECK && m_aCBPercent.IsEnabled())
             ++nNumberOfCheckedLabelParts;
-        if( m_aCBCategory.IsChecked() )
+        if (m_aCBCategory.GetState() != STATE_NOCHECK)
             ++nNumberOfCheckedLabelParts;
         m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
         bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index e0bf6ce..0f31720 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -231,7 +231,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
                 pItemConverter =  new wrapper::DataPointItemConverter( xChartModel, xContext,
                                         xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel,
                                         uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
-                                        eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, false,
+                                        eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true,
                                         nNumberFormat, nPercentNumberFormat );
                     break;
             }
commit fc04a3a9702580902312f5e8d6f3abd52f108663
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Dec 7 21:14:50 2012 -0500

    bnc#791952: Use "center" label placement for "Best fit" in pie charts.
    
    It works better this way for Excel interoperability.  In Excel, Best fit
    is slightly different than the center placement, but the two are pretty
    close in pie charts.
    
    Change-Id: I7f04a1babb04fd488d8cf90df247c294fa9d7b67

diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index fff4e98..e8fc689 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -449,9 +449,15 @@ void PieChart::createShapes()
                     }
 
                     sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, m_nDimension, m_pPosHelper->isSwapXAndY() );
+
+                    // AVOID_OVERLAP is in fact "Best fit" in the UI.
                     bool bMovementAllowed = ( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP );
                     if( bMovementAllowed )
-                        nLabelPlacement = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+                        // Use center for "Best fit" for now. In the future we
+                        // may want to implement a real best fit algorithm.
+                        // But center is good enough, and close to what Excel
+                        // does.
+                        nLabelPlacement = ::com::sun::star::chart::DataLabelPlacement::CENTER;
 
                     LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
                     sal_Int32 nScreenValueOffsetInRadiusDirection = 0 ;
commit ba88d2330b828a3f6971b323ff99c4bf2d2420c3
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Dec 7 19:48:50 2012 -0500

    bnc#791952: Better placement of 3D pie chart data labels.
    
    This value appears to control the logical vertical offset of data labels
    along the z-axis for 3D pie charts (no effect in 2D pie charts).  With
    -0.5, the data labels appear lifted from the top surface of the pie chart.
    With -1.0, the labels get placed right at the top surface, which improves
    the precision of data label positions.
    
    With this change, data labels that are centered are really centered inside
    their respective pie segments.
    
    Change-Id: I26d5d7cb7f68bd09131b70bcb4fc030ac924bcce

diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index b62d9ae..fff4e98 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -431,7 +431,7 @@ void PieChart::createShapes()
                 }
 
                 //create data point
-                double fLogicZ = -0.5;//as defined
+                double fLogicZ = -1.0; // For 3D pie chart label position
                 uno::Reference<drawing::XShape> xPointShape(
                     createDataPoint( xSeriesGroupShape_Shapes, xPointProperties
                                     , fUnitCircleStartAngleDegree, fUnitCircleWidthAngleDegree
commit eb352210aabd57832cc906a334cde472253a9104
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Dec 7 16:05:05 2012 -0500

    Remove duplicate defines and put it into a common place.
    
    Change-Id: I55415985f37970e4d1ba8605e6d22c45198fe19f

diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index 7bf75e6..8489ab3 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -26,6 +26,7 @@
 #include "DiagramHelper.hxx"
 #include "ChartTypeHelper.hxx"
 #include "ThreeDHelper.hxx"
+#include "defines.hxx"
 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
 #include <svx/sdr/overlay/overlaymanager.hxx>
 
@@ -37,8 +38,6 @@
 #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
 #include <drawinglayer/geometry/viewinformation3d.hxx>
 
-#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
-
 //.............................................................................
 namespace chart
 {
diff --git a/chart2/source/inc/defines.hxx b/chart2/source/inc/defines.hxx
new file mode 100644
index 0000000..14f6c25
--- /dev/null
+++ b/chart2/source/inc/defines.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __CHART2_DEFINES_HXX__
+#define __CHART2_DEFINES_HXX__
+
+#define FIXED_SIZE_FOR_3D_CHART_VOLUME 10000.0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index 20f5f69..66199cc 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -24,6 +24,8 @@
 #include "ChartTypeHelper.hxx"
 #include "BaseGFXHelper.hxx"
 #include "DataSeriesHelper.hxx"
+#include "defines.hxx"
+
 #include <editeng/unoprnms.hxx>
 #include <com/sun/star/beans/XPropertyState.hpp>
 #include <com/sun/star/chart2/XDiagram.hpp>
@@ -43,8 +45,6 @@ using ::rtl::math::cos;
 using ::rtl::math::sin;
 using ::rtl::math::tan;
 
-#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
-
 namespace
 {
 
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 4b627da..6d8f1ab 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -33,6 +33,7 @@
 #include "VAxisBase.hxx"
 #include "ViewDefines.hxx"
 #include "DataSeriesHelper.hxx"
+#include "defines.hxx"
 #include "chartview/ExplicitValueProvider.hxx"
 #include <com/sun/star/chart2/AxisType.hpp>
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 9fbed71..533638d 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -42,6 +42,7 @@
 #include "RelativePositionHelper.hxx"
 #include "DateHelper.hxx"
 #include "DiagramHelper.hxx"
+#include "defines.hxx"
 
 //only for creation: @todo remove if all plotter are uno components and instanciated via servicefactory
 #include "BarChart.hxx"
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 0513132..f3dd98e 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -28,6 +28,7 @@
 #include "CommonConverters.hxx"
 #include "ChartTypeHelper.hxx"
 #include "ThreeDHelper.hxx"
+#include "defines.hxx"
 #include <editeng/unoprnms.hxx>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
diff --git a/chart2/source/view/inc/ViewDefines.hxx b/chart2/source/view/inc/ViewDefines.hxx
index e86058b..5a38fcd 100644
--- a/chart2/source/view/inc/ViewDefines.hxx
+++ b/chart2/source/view/inc/ViewDefines.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef _CHART_COMMONDEFINES_HXX
-#define _CHART_COMMONDEFINES_HXX
+#ifndef __CHART2_VIEWDEFINES_HXX__
+#define __CHART2_VIEWDEFINES_HXX__
 
 namespace chart
 {
@@ -26,7 +26,6 @@ namespace chart
 //
 //=========================================================================
 #define CHART_3DOBJECT_SEGMENTCOUNT ((sal_Int32)32)
-#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
 //There needs to be a little distance betweengrid lines and walls in 3D, otherwise the lines are partly hidden by the walls
 #define GRID_TO_WALL_DISTANCE (1.0)
 
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ab2ea1c..f2ace4a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -46,6 +46,7 @@
 #include "BaseGFXHelper.hxx"
 #include "DataSeriesHelper.hxx"
 #include "DateHelper.hxx"
+#include "defines.hxx"
 
 #include <rtl/uuid.h>
 #include <comphelper/scopeguard.hxx>
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index de9deda..931a928 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -25,6 +25,7 @@
 #include "ShapeFactory.hxx"
 #include "PropertyMapper.hxx"
 #include "DateHelper.hxx"
+#include "defines.hxx"
 
 #include <com/sun/star/chart/TimeUnit.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>


More information about the Libreoffice-commits mailing list