[Libreoffice-commits] .: Branch 'distro/suse/suse-3.6' - 3 commits - chart2/source

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


 chart2/source/controller/dialogs/res_DataLabel.cxx           |    9 +++++----
 chart2/source/controller/main/ChartController_Properties.cxx |    2 +-
 chart2/source/view/charttypes/PieChart.cxx                   |   10 ++++++++--
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 495be57b8238361297f1834c2afbf808f1e55a3d
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 1690ecd..c50d2b4 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -291,14 +291,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 19f146a..005c076 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -242,7 +242,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
                                         xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel,
                                         pNumberFormatterWrapper,
                                         uno::Reference< lang::XMultiServiceFactory >( xChartModel, uno::UNO_QUERY ),
-                                        eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, false,
+                                        eMapTo, pRefSize, bDataSeries, bUseSpecialFillColor, nSpecialFillColor, true,
                                         nNumberFormat, nPercentNumberFormat );
                     break;
             }
commit 4128a957d7f41248f3e449ff002eb9c54b60d276
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 8d558f1..e1ecf5b 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -460,9 +460,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 263861b0f6a3ea4581d966b42a10fae65a21c2fc
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 5e7e167..8d558f1 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -442,7 +442,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


More information about the Libreoffice-commits mailing list